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

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

[PATCH] Fix strsep


Hi!

Recent bits/string2.h change broke strsep:
The problem is that outside of _LIBC there is no __strsep prototype.
Here is one possible patch (but I wonder why we actually need to export that
symbol from libc: __strsep macro could as well use
#if !defined _LIBC && defined (__USE_BSD)
#define __strsep_g(s, reject) strsep(s, reject)
#else
#define __strsep_g(s, reject) __strsep(s, reject)
#endif
#define __strsep .... __strsep_g(s, reject); ...
...
#ifdef __USE_BSD
# define strsep(s, reject) __strsep(s, reject)
#endif

I mean applications have no business to use __strsep and the code above
would ensure that apps outside of libc will use strsep@GLIBC_2.0, while
libc internally would use __strsep. This would have the advantage of
bypassing plt when calling the generic version of strsep, plus
__strsep@@GLIBC_2.2.5 symbol could be killed.

2001-10-03  Jakub Jelinek  <jakub@redhat.com>

	* string/bits/string2.h (__strsep): Add prototype.

--- libc/string/bits/string2.h.jj	Thu Sep 27 23:22:25 2001
+++ libc/string/bits/string2.h	Wed Oct  3 19:00:33 2001
@@ -1087,6 +1087,8 @@ __strtok_r_1c (char *__s, char __sep, ch
 
 #if !defined _HAVE_STRING_ARCH_strsep || defined _FORCE_INLINES
 # ifndef _HAVE_STRING_ARCH_strsep
+
+extern char *__strsep (char **__stringp, __const char *__delim);
 #  define __strsep(s, reject) \
   __extension__								      \
   ({ char __r0, __r1, __r2;						      \

	Jakub


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