summaryrefslogtreecommitdiffstats
path: root/newlib/libc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2016-07-06 15:41:35 +0200
committerCorinna Vinschen <corinna@vinschen.de>2016-07-06 15:41:35 +0200
commita68ca43b9014ae45feb3162a5f066524e2b38e1a (patch)
tree425e78959d1d619cb5c920b772559f864d5da46a /newlib/libc
parentb9ac3c2c8b761b74d09db3bbd0d0498cd7110d94 (diff)
downloadcygnal-a68ca43b9014ae45feb3162a5f066524e2b38e1a.tar.gz
cygnal-a68ca43b9014ae45feb3162a5f066524e2b38e1a.tar.bz2
cygnal-a68ca43b9014ae45feb3162a5f066524e2b38e1a.zip
Redefine locale info in struct _reent for per-thread locales
The _reent members _current_category and _current_locale are not used at all. _current_locale is set to "C" in various points of the code but its value is just as unused as _current_category. This patch redefines these members without changing the size of the structure to allow for an implementation of per-thread locales per POSIX-1.2008 (i.e. uselocale and usage of the per-thread locale in subsequent function calls). Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/include/sys/reent.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index 5481ca234..28fbecbdc 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -37,6 +37,11 @@ typedef __uint32_t __ULong;
struct _reent;
+/* TODO: This structure type isn't defined yet. It's supposed to be used
+ by locale-specific functions in case a pre-thread locale per SUSv4 has
+ been specified. */
+struct _thr_locale_t;
+
/*
* If _REENT_SMALL is defined, we make struct _reent as small as possible,
* by having nearly everything possible allocated at first use.
@@ -384,8 +389,9 @@ struct _reent
int __sdidinit; /* 1 means stdio has been init'd */
- int _current_category; /* unused */
- _CONST char *_current_locale; /* unused */
+ /* TODO */
+ int _unspecified_locale_info; /* unused, reserved for locale stuff */
+ struct _thr_locale_t *_locale;/* per-thread locale */
struct _mprec *_mp;
@@ -450,7 +456,6 @@ extern const struct __sFILE_fake __sf_fake_stderr;
{ (var)->_stdin = (__FILE *)&__sf_fake_stdin; \
(var)->_stdout = (__FILE *)&__sf_fake_stdout; \
(var)->_stderr = (__FILE *)&__sf_fake_stderr; \
- (var)->_current_locale = "C"; \
}
/* Only built the assert() calls if we are built with debugging. */
@@ -577,8 +582,9 @@ struct _reent
int _inc; /* used by tmpnam */
char _emergency[_REENT_EMERGENCY_SIZE];
- int _current_category; /* used by setlocale */
- _CONST char *_current_locale;
+ /* TODO */
+ int _unspecified_locale_info; /* unused, reserved for locale stuff */
+ struct _thr_locale_t *_locale;/* per-thread locale */
int __sdidinit; /* 1 means stdio has been init'd */
@@ -697,7 +703,6 @@ struct _reent
{ (var)->_stdin = &(var)->__sf[0]; \
(var)->_stdout = &(var)->__sf[1]; \
(var)->_stderr = &(var)->__sf[2]; \
- (var)->_current_locale = "C"; \
(var)->_new._reent._rand_next = 1; \
(var)->_new._reent._r48._seed[0] = _RAND48_SEED_0; \
(var)->_new._reent._r48._seed[1] = _RAND48_SEED_1; \