diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2016-07-22 19:57:56 +0200 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2016-08-15 10:56:57 +0200 |
commit | 53f84bb5ac76d95bbc5267596994119112e1a49b (patch) | |
tree | 3f18011b92b52a0724cb978b2e3c9cb46f7e1027 /winsup/cygwin/nlsfuncs.cc | |
parent | 1498c79db89ea0e02a49ffa34e71da480e37165e (diff) | |
download | cygnal-53f84bb5ac76d95bbc5267596994119112e1a49b.tar.gz cygnal-53f84bb5ac76d95bbc5267596994119112e1a49b.tar.bz2 cygnal-53f84bb5ac76d95bbc5267596994119112e1a49b.zip |
Rearrange struct __locale_t pointers into an array
This allows looping through the structs and buffers. Also
rearrange definitions to follow order of LC_xxx values.
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/cygwin/nlsfuncs.cc')
-rw-r--r-- | winsup/cygwin/nlsfuncs.cc | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc index 021af44cb..4b926267e 100644 --- a/winsup/cygwin/nlsfuncs.cc +++ b/winsup/cygwin/nlsfuncs.cc @@ -1074,7 +1074,7 @@ __collate_load_locale (struct __locale_t *locale, const char *name, void *f_mbtowc, const char *charset) { const struct lc_collate_T *ccop; - char *buf = NULL; + char *bufp = NULL; LCID lcid = __get_lcid_from_locale (name); if (lcid == (LCID) -1) @@ -1082,23 +1082,23 @@ __collate_load_locale (struct __locale_t *locale, const char *name, if (!lcid) { ccop = &_C_collate_locale; - buf = NULL; + bufp = NULL; } else { - buf = (char *) calloc (1, sizeof (struct lc_collate_T)); - if (!buf) + bufp = (char *) calloc (1, sizeof (struct lc_collate_T)); + if (!bufp) return -1; - struct lc_collate_T *cop = (struct lc_collate_T *) buf; + struct lc_collate_T *cop = (struct lc_collate_T *) bufp; cop->lcid = lcid; cop->mbtowc = (mbtowc_p) f_mbtowc; stpcpy (cop->codeset, charset); ccop = (const struct lc_collate_T *) cop; } - locale->collate = ccop; - if (locale->collate_buf) - free (locale->collate_buf); - locale->collate_buf = buf; + locale->lc_cat[LC_COLLATE].ptr = ccop; + if (locale->lc_cat[LC_COLLATE].buf) + free (locale->lc_cat[LC_COLLATE].buf); + locale->lc_cat[LC_COLLATE].buf = bufp; return 0; } |