[tbrowder@home.com] libc/2173: libc compatibility with C++

Andreas Jaeger aj@suse.de
Mon Apr 2 00:05:00 GMT 2001


Here's a patch for the bug report.  Ok to commit?

Andreas

2001-04-02  Andreas Jaeger  <aj@suse.de>

	* string/string.h (strndupa): Add cast for C++ conformance.
	(strdupa): Likewise.
	Fixes PR libc/2173, reported by tbrowder@home.com. 

============================================================
Index: string/string.h
--- string/string.h	2001/02/06 18:27:12	1.79
+++ string/string.h	2001/04/02 07:05:29
@@ -135,7 +135,7 @@
     ({									      \
       __const char *__old = (s);					      \
       size_t __len = strlen (__old) + 1;				      \
-      char *__new = __builtin_alloca (__len);				      \
+      char *__new = (char *) __builtin_alloca (__len);			      \
       (char *) memcpy (__new, __old, __len);				      \
     }))
 
@@ -145,7 +145,7 @@
     ({									      \
       __const char *__old = (s);					      \
       size_t __len = strnlen (__old, (n));				      \
-      char *__new = __builtin_alloca (__len + 1);			      \
+      char *__new = (char *) __builtin_alloca (__len + 1);		      \
       __new[__len] = '\0';						      \
       (char *) memcpy (__new, __old, __len);				      \
     }))





More information about the Libc-alpha mailing list