Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2002-04-02 03:06:21 +0400
committerJeff Johnston <jjohnstn@redhat.com>2002-04-02 03:06:21 +0400
commitd4dca0e42e10a00ec1bdcc444083e86765b15ea3 (patch)
treec5bddb1c78cc98d7766c6b38c1d05357da082e1f /newlib/libc/stdlib
parent54a7c6d2beffa00ab22e8bdf93da74989fd0d49d (diff)
2002-04-01 Jeff Johnston <jjohnstn@redhat.com>
* 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.
Diffstat (limited to 'newlib/libc/stdlib')
-rw-r--r--newlib/libc/stdlib/mblen.c4
-rw-r--r--newlib/libc/stdlib/mbtowc.c4
-rw-r--r--newlib/libc/stdlib/wctomb.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/newlib/libc/stdlib/mblen.c b/newlib/libc/stdlib/mblen.c
index d9b774e45..c85a6a734 100644
--- a/newlib/libc/stdlib/mblen.c
+++ b/newlib/libc/stdlib/mblen.c
@@ -51,9 +51,9 @@ _DEFUN (mblen, (s, n),
size_t n)
{
#ifdef MB_CAPABLE
- static int state;
+ _REENT_CHECK_MISC(_REENT);
- return _mbtowc_r (_REENT, NULL, s, n, &state);
+ return _mbtowc_r (_REENT, NULL, s, n, &(_REENT_MBLEN_STATE(_REENT)));
#else /* not MB_CAPABLE */
if (s == NULL || *s == '\0')
return 0;
diff --git a/newlib/libc/stdlib/mbtowc.c b/newlib/libc/stdlib/mbtowc.c
index 5e34fe366..0d16f0d9d 100644
--- a/newlib/libc/stdlib/mbtowc.c
+++ b/newlib/libc/stdlib/mbtowc.c
@@ -60,9 +60,9 @@ _DEFUN (mbtowc, (pwc, s, n),
size_t n)
{
#ifdef MB_CAPABLE
- static int state;
+ _REENT_CHECK_MISC(_REENT);
- return _mbtowc_r (_REENT, pwc, s, n, &state);
+ return _mbtowc_r (_REENT, pwc, s, n, &(_REENT_MBTOWC_STATE(_REENT)));
#else /* not MB_CAPABLE */
if (s == NULL)
return 0;
diff --git a/newlib/libc/stdlib/wctomb.c b/newlib/libc/stdlib/wctomb.c
index a6812508f..5cff10fff 100644
--- a/newlib/libc/stdlib/wctomb.c
+++ b/newlib/libc/stdlib/wctomb.c
@@ -54,9 +54,9 @@ _DEFUN (wctomb, (s, wchar),
wchar_t wchar)
{
#ifdef MB_CAPABLE
- static int state;
+ _REENT_CHECK_MISC(_REENT);
- return _wctomb_r (_REENT, s, wchar, &state);
+ return _wctomb_r (_REENT, s, wchar, &(_REENT_WCTOMB_STATE(_REENT)));
#else /* not MB_CAPABLE */
if (s == NULL)
return 0;