This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A patch for string/string.h



I'm not sure about this patch.  You cut out the inclusion of the
bits/string*.h files entirely if POSIX or XOPEN.  Wouldn't it make
more sense to narrow down what those files include?  In fact
bits/string.h doesn't include anything, and the only include in
bits/string2.h that can cause standards trouble is of stdlib.h.  We
already have that include predicated on !__STRICT_ANSI__.  If we
change the condition to __USE_MISC || __USE_GNU, string.h is clean and
the only lost optimization is of strdup() which isn't standard anyway.

Patch:

1998-10-24 22:34 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* string/bits/string2.h: Inline strdup+friends only if
	__USE_MISC || __USE_GNU (prevents namespace pollution).

============================================================
Index: string/bits/string2.h
--- string/bits/string2.h	1998/10/15 08:03:49	1.24
+++ string/bits/string2.h	1998/10/25 02:34:09
@@ -1011,9 +1011,9 @@
 #endif
 
 /* We need the memory allocation functions for inline strdup().
-   Referring to stdlib.h (even minimally) is not allowed if
-   __STRICT_ANSI__. */
-#ifndef __STRICT_ANSI__
+   Referring to stdlib.h (even minimally) is not allowed
+   in any of the tight standards compliant modes. */
+#if defined __USE_MISC || defined __USE_GNU
 
 #if !defined _HAVE_STRING_ARCH_strdup || !defined _HAVE_STRING_ARCH_strndup
 # define __need_malloc_and_calloc


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]