libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 363] Allow better compile time type checking for lt_dladvise


From: Eric Blake
Subject: Re: [PATCH 363] Allow better compile time type checking for lt_dladvise
Date: Thu, 24 Apr 2008 16:25:22 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Gary V. Vaughan <gary <at> gnu.org> writes:

> > Does this work with C and C++ compilers?
> 
> Yes.

> 
> I took that as a yes vote and pushed the patch. :)

Well, almost.  The MALLOC macro already includes a cast, as part of allocating 
an array of n elements of the type.  And lt_dlhandle->deplibs is an array of 
lt_dlhandle (ie. lt_dlhandle*, ie. lt__handle**).  Therefore, the original code 
was a) mallocing the wrong size [n*sizeof (struct lt__handle) instead of 
n*sizeof (lt_dlhandle)], b) explicitly casting to the wrong type [lt_dlhandle 
instead of lt_dlhandle*] in spite of the implicit cast given by MALLOC.

So I'm committing this as obvious.


>From fe9c6440a352de1d7b2d148fd4393c669927ac82 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Thu, 24 Apr 2008 10:05:12 -0600
Subject: [PATCH] Fix bug in 2008-04-21 type improvements.

* libltdl/ltdl.c (load_deplibs): Fix casting bug.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog      |    5 +++++
 libltdl/ltdl.c |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9e97b71..737c5c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-04-24  Eric Blake  <address@hidden>
+
+       Fix bug in 2008-04-21 type improvements.
+       * libltdl/ltdl.c (load_deplibs): Fix casting bug.
+
 2008-04-23  Michael Haubenwallner  <address@hidden>
 
        Use /nonexistent as destination for files not to be installed.
diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c
index c8edcb4..a89c6bb 100644
--- a/libltdl/ltdl.c
+++ b/libltdl/ltdl.c
@@ -921,7 +921,7 @@ load_deplibs (lt_dlhandle handle, char *deplibs)
       lt_dlhandle cur = handle;
       int      j = 0;
 
-      cur->deplibs = (lt_dlhandle) MALLOC (struct lt__handle, depcount);
+      cur->deplibs = MALLOC (lt_dlhandle, depcount);
       if (!cur->deplibs)
        goto cleanup_names;
 
-- 
1.5.5.1








reply via email to

[Prev in Thread] Current Thread [Next in Thread]