summary refs log tree commit diff
path: root/string/string.h
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-01-13 00:46:48 +0000
committerRoland McGrath <roland@gnu.org>1996-01-13 00:46:48 +0000
commit02ac66c50d2faf11677911fd99579869f24795ef (patch)
treebafee0af52b84a7fe2f40725fa158ab6e7d1d6e1 /string/string.h
parentd94d8f2a5960683c324e184f1240b0c26fd3bc09 (diff)
downloadglibc-02ac66c50d2faf11677911fd99579869f24795ef.tar.gz
glibc-02ac66c50d2faf11677911fd99579869f24795ef.tar.xz
glibc-02ac66c50d2faf11677911fd99579869f24795ef.zip
Fri Jan 12 13:40:01 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu> cvs/libc-960113
	* posix/gnu/types.h: Moved to sysdeps/generic/gnu/types.h.

	* posix/glob.c (glob): Add parens in glob call flags arg for
	GLOB_BRACE case.

	* string/string.h (strdupa): New macro.

	* stdio-common/vfscanf.c (%[): Grok ] as first char in set, not
	terminator on empty set.  From drepper.
Diffstat (limited to 'string/string.h')
-rw-r--r--string/string.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/string/string.h b/string/string.h
index 0f995319bb..95dcba0041 100644
--- a/string/string.h
+++ b/string/string.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1993, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
@@ -91,6 +91,16 @@ extern size_t strxfrm __P ((char *__dest, __const char *__src, size_t __n));
 extern char *strdup __P ((__const char *__s));
 #endif
 
+#if defined (__USE_GNU) && defined (__GNUC__)
+/* Duplicate S, returning an identical alloca'd string.  */
+#define strdupa(s)							      \
+({									      \
+    const char *__old = (s);						      \
+    size_t __len = strlen (__old) + 1;					      \
+    memcpy (__builtin_alloca (__len), __old, __len);			      \
+})
+#endif
+
 /* Find the first occurrence of C in S.  */
 extern char *strchr __P ((__const char *__s, int __c));
 /* Find the last occurrence of C in S.  */