about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2004-11-11 22:15:51 +0000
committerRoland McGrath <roland@gnu.org>2004-11-11 22:15:51 +0000
commit37b1a1540170d8154435099d50da5b34a56bdbf1 (patch)
treea68878f77a62721aaf7e6f5494152c3b5963cc40 /sysdeps
parenta579c7f543da8cc2a097d5df1f98687bd1addae8 (diff)
downloadglibc-37b1a1540170d8154435099d50da5b34a56bdbf1.tar.gz
glibc-37b1a1540170d8154435099d50da5b34a56bdbf1.tar.xz
glibc-37b1a1540170d8154435099d50da5b34a56bdbf1.zip
[BZ #542]
2004-11-11  Simon Josefsson  <jas@extundo.com>
	[BZ #542]
	* sysdeps/generic/strtok_r.c [HAVE_CONFIG_H]: Include config.h.
	[!_LIBC]: Include strtok_r.h (in gnulib), map __strtok_r to
	strtok_r and __rawmemchr to strch.
	(__strtok_r): Use C89 prototype.
	[weak_alias]: Move calls to libc_hidden_def and weak_alias into
	this #ifdef.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/generic/strtok_r.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/sysdeps/generic/strtok_r.c b/sysdeps/generic/strtok_r.c
index 3a5c047b8c..b11cb520f6 100644
--- a/sysdeps/generic/strtok_r.c
+++ b/sysdeps/generic/strtok_r.c
@@ -17,11 +17,22 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
 #include <string.h>
 
 #undef strtok_r
 #undef __strtok_r
 
+#ifndef _LIBC
+/* Get specification.  */
+# include "strtok_r.h"
+# define __strtok_r strtok_r
+# define __rawmemchr strchr
+#endif
+
 /* Parse S into tokens separated by characters in DELIM.
    If S is NULL, the saved pointer in SAVE_PTR is used as
    the next starting point.  For example:
@@ -33,10 +44,7 @@
 		// s = "abc\0-def\0"
 */
 char *
-__strtok_r (s, delim, save_ptr)
-     char *s;
-     const char *delim;
-     char **save_ptr;
+__strtok_r (char *s, const char *delim, char **save_ptr)
 {
   char *token;
 
@@ -65,5 +73,7 @@ __strtok_r (s, delim, save_ptr)
     }
   return token;
 }
+#ifdef weak_alias
 libc_hidden_def (__strtok_r)
 weak_alias (__strtok_r, strtok_r)
+#endif