From d4dca0e42e10a00ec1bdcc444083e86765b15ea3 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Mon, 1 Apr 2002 23:06:21 +0000 Subject: 2002-04-01 Jeff Johnston * libc/include/sys/reent.h (_REENT_INIT_PTR): New macro for initializing a struct _reent that has been dynamically allocated. (_REENT_CHECK_MISC): New macro that checks _misc struct for _REENT_SMALL and does nothing otherwise. (_REENT_STRTOK_LAST): New macro for reentrant strtok. (_REENT_MBLEN_STATE): New macro for reentrant mblen. (_REENT_MBTOWC_STATE): New macro for reentrant mbtowc. (_REENT_WCTOMB_STATE): New macro for reentrant wctomb. [_REENT_SMALL](struct _misc_reent): New structure containing miscellaneous reentrant areas needed by newlib. [_REENT_SMALL](struct _reent): Add _misc pointer. [_REENT_SMALL](_REENT_INIT_MISC): New macro. * libc/string/strtok (strtok): Change to use _REENT_CHECK_MISC and _REENT_STRTOK_LAST macros. * libc/stdlib/mblen (mblen): Change to use _REENT_CHECK_MISC and _REENT_MBLEN_STATE macros. * libc/stdlib/mbtowc (mbtowc): Change to use _REENT_CHECK_MISC and _REENT_MBTOWC_STATE macros. * libc/stdlib/wctomb (wctomb): Change to use _REENT_CHECK_MISC and _REENT_WCTOMB_STATE macros. --- newlib/libc/string/strtok.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'newlib/libc/string') diff --git a/newlib/libc/string/strtok.c b/newlib/libc/string/strtok.c index 17228d223..292c16743 100644 --- a/newlib/libc/string/strtok.c +++ b/newlib/libc/string/strtok.c @@ -73,7 +73,7 @@ _DEFUN (strtok, (s, delim), register char *s _AND register const char *delim) { - static char *last; - return strtok_r (s, delim, &last); + _REENT_CHECK_MISC(_REENT); + return strtok_r (s, delim, &(_REENT_STRTOK_LAST(_REENT))); } #endif -- cgit v1.2.3