about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--string/bits/string2.h4
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a1ba69b3c7..6e830311a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2007-10-05  Ulrich Drepper  <drepper@redhat.com>
 
+	[BZ #5113]
+	* string/bits/string2.h (__strdup): Cast parameters to calloc to
+	avoid warning with -Wconversion.
+	(__strndup): Likewise.
+	Patch to 50% by Christian Iseli <christian.iseli@licr.org>.
+
 	[BZ #5112]
 	* nscd/connections.c (restart): Don't resync if database is
 	disabled.  Patch mostly by Brian De Wolf <bldewolf@csupomona.edu>.
diff --git a/string/bits/string2.h b/string/bits/string2.h
index 1e4d736a17..6a18a1afc6 100644
--- a/string/bits/string2.h
+++ b/string/bits/string2.h
@@ -1305,7 +1305,7 @@ extern char *__strdup (__const char *__string) __THROW __attribute_malloc__;
 #  define __strdup(s) \
   (__extension__ (__builtin_constant_p (s) && __string2_1bptr_p (s)	      \
 		  ? (((__const char *) (s))[0] == '\0'			      \
-		     ? (char *) calloc (1, 1)				      \
+		     ? (char *) calloc ((size_t) 1, (size_t) 1)		      \
 		     : ({ size_t __len = strlen (s) + 1;		      \
 			  char *__retval = (char *) malloc (__len);	      \
 			  if (__retval != NULL)				      \
@@ -1325,7 +1325,7 @@ extern char *__strndup (__const char *__string, size_t __n)
 #  define __strndup(s, n) \
   (__extension__ (__builtin_constant_p (s) && __string2_1bptr_p (s)	      \
 		  ? (((__const char *) (s))[0] == '\0'			      \
-		     ? (char *) calloc (1, 1)				      \
+		     ? (char *) calloc ((size_t) 1, (size_t) 1)		      \
 		     : ({ size_t __len = strlen (s) + 1;		      \
 			  size_t __n = (n);				      \
 			  char *__retval;				      \