This is the mail archive of the
glibc-bugs@sources.redhat.com
mailing list for the glibc project.
[Bug libc/542] New: Fix to strtok_r.c to make it possible to use in gnulib
- From: "simon at josefsson dot org" <sourceware-bugzilla at sources dot redhat dot com>
- To: glibc-bugs at sources dot redhat dot com
- Date: 11 Nov 2004 19:40:11 -0000
- Subject: [Bug libc/542] New: Fix to strtok_r.c to make it possible to use in gnulib
- Reply-to: sourceware-bugzilla at sources dot redhat dot com
Hello. Another fix to a file that will be used in gnulib.
2004-11-11 Simon Josefsson <jas@extundo.com>
* 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.
Index: strtok_r.c
===================================================================
RCS file: /cvs/glibc/libc/sysdeps/generic/strtok_r.c,v
retrieving revision 1.12
diff -u -p -u -w -r1.12 strtok_r.c
--- strtok_r.c 10 Jul 2004 19:54:26 -0000 1.12
+++ strtok_r.c 11 Nov 2004 19:39:26 -0000
@@ -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
--
Summary: Fix to strtok_r.c to make it possible to use in gnulib
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: gotom at debian dot or dot jp
ReportedBy: simon at josefsson dot org
CC: glibc-bugs at sources dot redhat dot com
http://sources.redhat.com/bugzilla/show_bug.cgi?id=542
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.