[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: avoid compiler warning
From: |
Eric Blake |
Subject: |
Re: avoid compiler warning |
Date: |
Mon, 2 Nov 2009 19:17:36 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> writes:
> The compiler warning is bogus. Your patch pessimizes the code; IIRC it
> can cause runtime-initialization of the pointer.
>
> OK to commit a patch to change this to strlen.
Like so? (apologies in advance: gmane will probably botch the patch due to long
lines)
> Even better to post a
> GCC patch to avoid emitting this warning.
I have no idea where to patch that, but I guess I could go ahead and submit the
bug report.
From: Eric Blake <address@hidden>
Date: Mon, 2 Nov 2009 11:58:28 -0700
Subject: [PATCH] Allow gcc builds with -Wall -Werror.
* libltdl/ltdl.c (try_dlopen): Use strlen rather than LT_STRLEN on
an array that will never be NULL.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 6 ++++++
libltdl/ltdl.c | 2 +-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index caf125a..057f9a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-02 Eric Blake <address@hidden>
+
+ Allow gcc builds with -Wall -Werror.
+ * libltdl/ltdl.c (try_dlopen): Use strlen rather than LT_STRLEN on
+ an array that will never be NULL.
+
2009-11-01 Ralf Wildenhues <address@hidden>
Fix func_normal_abspath sed script for Solaris.
diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c
index 80b5675..a622357 100644
--- a/libltdl/ltdl.c
+++ b/libltdl/ltdl.c
@@ -1264,7 +1264,7 @@ try_dlopen (lt_dlhandle *phandle, const char *filename,
const char *ext,
if (vtable)
{
/* name + "." + libext + NULL */
- archive_name = MALLOC (char, LT_STRLEN (name) + LT_STRLEN (libext) +
2);
+ archive_name = MALLOC (char, LT_STRLEN (name) + strlen (libext) + 2);
*phandle = (lt_dlhandle) lt__zalloc (sizeof (struct lt__handle));
if ((*phandle == NULL) || (archive_name == NULL))
--
1.6.4.2