diff options
author | Tim J. Robbins <tjr@FreeBSD.org> | 2004-06-23 07:01:44 +0000 |
---|---|---|
committer | Tim J. Robbins <tjr@FreeBSD.org> | 2004-06-23 07:01:44 +0000 |
commit | ddc1eded85352aaaea972947cbf133d0ded34d53 (patch) | |
tree | d89ed2a150bbb4fcdbff69b2c14d5d87b5dfbdfe /lib | |
parent | 587a4462c938e6c9fca15367c9d05246237b3fa5 (diff) |
Prefix the names of members of _RuneLocale and its sub-structures
with ``__'' to avoid polluting the namespace. This doesn't change the
documented rune interface at all, but breaks applications that accessed
_RuneLocale directly.
Notes
Notes:
svn path=/head/; revision=130961
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/locale/euc.c | 10 | ||||
-rw-r--r-- | lib/libc/locale/rune.c | 101 | ||||
-rw-r--r-- | lib/libc/locale/runetype.c | 16 | ||||
-rw-r--r-- | lib/libc/locale/setrunelocale.c | 26 | ||||
-rw-r--r-- | lib/libc/locale/tolower.c | 12 | ||||
-rw-r--r-- | lib/libc/locale/toupper.c | 12 |
6 files changed, 90 insertions, 87 deletions
diff --git a/lib/libc/locale/euc.c b/lib/libc/locale/euc.c index 746ddc155124..9b0b7e553a79 100644 --- a/lib/libc/locale/euc.c +++ b/lib/libc/locale/euc.c @@ -74,10 +74,10 @@ _EUC_init(_RuneLocale *rl) int x, new__mb_cur_max; char *v, *e; - if (rl->variable == NULL) + if (rl->__variable == NULL) return (EFTYPE); - v = (char *)rl->variable; + v = (char *)rl->__variable; while (*v == ' ' || *v == '\t') ++v; @@ -109,8 +109,8 @@ _EUC_init(_RuneLocale *rl) free(ei); return (EFTYPE); } - rl->variable = ei; - rl->variable_len = sizeof(_EucInfo); + rl->__variable = ei; + rl->__variable_len = sizeof(_EucInfo); _CurrentRuneLocale = rl; __mb_cur_max = new__mb_cur_max; __mbrtowc = _EUC_mbrtowc; @@ -126,7 +126,7 @@ _EUC_mbsinit(const mbstate_t *ps) return (ps == NULL || ((const _EucState *)ps)->want == 0); } -#define CEI ((_EucInfo *)(_CurrentRuneLocale->variable)) +#define CEI ((_EucInfo *)(_CurrentRuneLocale->__variable)) #define _SS2 0x008e #define _SS3 0x008f diff --git a/lib/libc/locale/rune.c b/lib/libc/locale/rune.c index 1783cba8965e..d4ea5a6748b3 100644 --- a/lib/libc/locale/rune.c +++ b/lib/libc/locale/rune.c @@ -92,86 +92,89 @@ _Read_RuneMagi(fp) rl = (_RuneLocale *)data; lastp = data + sb.st_size; - rl->variable = rl + 1; + rl->__variable = rl + 1; - if (memcmp(rl->magic, _RUNE_MAGIC_1, sizeof(rl->magic))) { + if (memcmp(rl->__magic, _RUNE_MAGIC_1, sizeof(rl->__magic))) { free(data); errno = EFTYPE; return (NULL); } - rl->invalid_rune = ntohl(rl->invalid_rune); - rl->variable_len = ntohl(rl->variable_len); - rl->runetype_ext.nranges = ntohl(rl->runetype_ext.nranges); - rl->maplower_ext.nranges = ntohl(rl->maplower_ext.nranges); - rl->mapupper_ext.nranges = ntohl(rl->mapupper_ext.nranges); + rl->__invalid_rune = ntohl(rl->__invalid_rune); + rl->__variable_len = ntohl(rl->__variable_len); + rl->__runetype_ext.__nranges = ntohl(rl->__runetype_ext.__nranges); + rl->__maplower_ext.__nranges = ntohl(rl->__maplower_ext.__nranges); + rl->__mapupper_ext.__nranges = ntohl(rl->__mapupper_ext.__nranges); for (x = 0; x < _CACHED_RUNES; ++x) { - rl->runetype[x] = ntohl(rl->runetype[x]); - rl->maplower[x] = ntohl(rl->maplower[x]); - rl->mapupper[x] = ntohl(rl->mapupper[x]); + rl->__runetype[x] = ntohl(rl->__runetype[x]); + rl->__maplower[x] = ntohl(rl->__maplower[x]); + rl->__mapupper[x] = ntohl(rl->__mapupper[x]); } - rl->runetype_ext.ranges = (_RuneEntry *)rl->variable; - rl->variable = rl->runetype_ext.ranges + rl->runetype_ext.nranges; - if (rl->variable > lastp) { + rl->__runetype_ext.__ranges = (_RuneEntry *)rl->__variable; + rl->__variable = rl->__runetype_ext.__ranges + + rl->__runetype_ext.__nranges; + if (rl->__variable > lastp) { free(data); errno = EFTYPE; return (NULL); } - rl->maplower_ext.ranges = (_RuneEntry *)rl->variable; - rl->variable = rl->maplower_ext.ranges + rl->maplower_ext.nranges; - if (rl->variable > lastp) { + rl->__maplower_ext.__ranges = (_RuneEntry *)rl->__variable; + rl->__variable = rl->__maplower_ext.__ranges + + rl->__maplower_ext.__nranges; + if (rl->__variable > lastp) { free(data); errno = EFTYPE; return (NULL); } - rl->mapupper_ext.ranges = (_RuneEntry *)rl->variable; - rl->variable = rl->mapupper_ext.ranges + rl->mapupper_ext.nranges; - if (rl->variable > lastp) { + rl->__mapupper_ext.__ranges = (_RuneEntry *)rl->__variable; + rl->__variable = rl->__mapupper_ext.__ranges + + rl->__mapupper_ext.__nranges; + if (rl->__variable > lastp) { free(data); errno = EFTYPE; return (NULL); } - for (x = 0; x < rl->runetype_ext.nranges; ++x) { - rr = rl->runetype_ext.ranges; + for (x = 0; x < rl->__runetype_ext.__nranges; ++x) { + rr = rl->__runetype_ext.__ranges; - rr[x].min = ntohl(rr[x].min); - rr[x].max = ntohl(rr[x].max); - if ((rr[x].map = ntohl(rr[x].map)) == 0) { - int len = rr[x].max - rr[x].min + 1; - rr[x].types = rl->variable; - rl->variable = rr[x].types + len; - if (rl->variable > lastp) { + rr[x].__min = ntohl(rr[x].__min); + rr[x].__max = ntohl(rr[x].__max); + if ((rr[x].__map = ntohl(rr[x].__map)) == 0) { + int len = rr[x].__max - rr[x].__min + 1; + rr[x].__types = rl->__variable; + rl->__variable = rr[x].__types + len; + if (rl->__variable > lastp) { free(data); errno = EFTYPE; return (NULL); } while (len-- > 0) - rr[x].types[len] = ntohl(rr[x].types[len]); + rr[x].__types[len] = ntohl(rr[x].__types[len]); } else - rr[x].types = 0; + rr[x].__types = 0; } - for (x = 0; x < rl->maplower_ext.nranges; ++x) { - rr = rl->maplower_ext.ranges; + for (x = 0; x < rl->__maplower_ext.__nranges; ++x) { + rr = rl->__maplower_ext.__ranges; - rr[x].min = ntohl(rr[x].min); - rr[x].max = ntohl(rr[x].max); - rr[x].map = ntohl(rr[x].map); + rr[x].__min = ntohl(rr[x].__min); + rr[x].__max = ntohl(rr[x].__max); + rr[x].__map = ntohl(rr[x].__map); } - for (x = 0; x < rl->mapupper_ext.nranges; ++x) { - rr = rl->mapupper_ext.ranges; + for (x = 0; x < rl->__mapupper_ext.__nranges; ++x) { + rr = rl->__mapupper_ext.__ranges; - rr[x].min = ntohl(rr[x].min); - rr[x].max = ntohl(rr[x].max); - rr[x].map = ntohl(rr[x].map); + rr[x].__min = ntohl(rr[x].__min); + rr[x].__max = ntohl(rr[x].__max); + rr[x].__map = ntohl(rr[x].__map); } - if (((char *)rl->variable) + rl->variable_len > (char *)lastp) { + if (((char *)rl->__variable) + rl->__variable_len > (char *)lastp) { free(data); errno = EFTYPE; return (NULL); @@ -180,17 +183,17 @@ _Read_RuneMagi(fp) /* * Go out and zero pointers that should be zero. */ - if (!rl->variable_len) - rl->variable = 0; + if (!rl->__variable_len) + rl->__variable = 0; - if (!rl->runetype_ext.nranges) - rl->runetype_ext.ranges = 0; + if (!rl->__runetype_ext.__nranges) + rl->__runetype_ext.__ranges = 0; - if (!rl->maplower_ext.nranges) - rl->maplower_ext.ranges = 0; + if (!rl->__maplower_ext.__nranges) + rl->__maplower_ext.__ranges = 0; - if (!rl->mapupper_ext.nranges) - rl->mapupper_ext.ranges = 0; + if (!rl->__mapupper_ext.__nranges) + rl->__mapupper_ext.__ranges = 0; return (rl); } diff --git a/lib/libc/locale/runetype.c b/lib/libc/locale/runetype.c index def216c07f03..f7bf398ede35 100644 --- a/lib/libc/locale/runetype.c +++ b/lib/libc/locale/runetype.c @@ -45,22 +45,22 @@ ___runetype(c) __ct_rune_t c; { size_t lim; - _RuneRange *rr = &_CurrentRuneLocale->runetype_ext; + _RuneRange *rr = &_CurrentRuneLocale->__runetype_ext; _RuneEntry *base, *re; if (c < 0 || c == EOF) return(0L); /* Binary search -- see bsearch.c for explanation. */ - base = rr->ranges; - for (lim = rr->nranges; lim != 0; lim >>= 1) { + base = rr->__ranges; + for (lim = rr->__nranges; lim != 0; lim >>= 1) { re = base + (lim >> 1); - if (re->min <= c && c <= re->max) { - if (re->types) - return(re->types[c - re->min]); + if (re->__min <= c && c <= re->__max) { + if (re->__types) + return(re->__types[c - re->__min]); else - return(re->map); - } else if (c > re->max) { + return(re->__map); + } else if (c > re->__max) { base = re + 1; lim--; } diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c index 85b17a101457..de3ee06d7c37 100644 --- a/lib/libc/locale/setrunelocale.c +++ b/lib/libc/locale/setrunelocale.c @@ -159,33 +159,33 @@ __setrunelocale(const char *encoding) __mbsrtowcs = __mbsrtowcs_std; __wcrtomb = NULL; __wcsrtombs = __wcsrtombs_std; - rl->sputrune = __emulated_sputrune; - rl->sgetrune = __emulated_sgetrune; - if (strcmp(rl->encoding, "NONE") == 0) + rl->__sputrune = __emulated_sputrune; + rl->__sgetrune = __emulated_sgetrune; + if (strcmp(rl->__encoding, "NONE") == 0) ret = _none_init(rl); - else if (strcmp(rl->encoding, "UTF2") == 0) + else if (strcmp(rl->__encoding, "UTF2") == 0) ret = _UTF2_init(rl); - else if (strcmp(rl->encoding, "UTF-8") == 0) + else if (strcmp(rl->__encoding, "UTF-8") == 0) ret = _UTF8_init(rl); - else if (strcmp(rl->encoding, "EUC") == 0) + else if (strcmp(rl->__encoding, "EUC") == 0) ret = _EUC_init(rl); - else if (strcmp(rl->encoding, "GB18030") == 0) + else if (strcmp(rl->__encoding, "GB18030") == 0) ret = _GB18030_init(rl); - else if (strcmp(rl->encoding, "GB2312") == 0) + else if (strcmp(rl->__encoding, "GB2312") == 0) ret = _GB2312_init(rl); - else if (strcmp(rl->encoding, "GBK") == 0) + else if (strcmp(rl->__encoding, "GBK") == 0) ret = _GBK_init(rl); - else if (strcmp(rl->encoding, "BIG5") == 0) + else if (strcmp(rl->__encoding, "BIG5") == 0) ret = _BIG5_init(rl); - else if (strcmp(rl->encoding, "MSKanji") == 0) + else if (strcmp(rl->__encoding, "MSKanji") == 0) ret = _MSKanji_init(rl); else ret = EFTYPE; if (ret == 0) { if (CachedRuneLocale != NULL) { /* See euc.c */ - if (strcmp(CachedRuneLocale->encoding, "EUC") == 0) - free(CachedRuneLocale->variable); + if (strcmp(CachedRuneLocale->__encoding, "EUC") == 0) + free(CachedRuneLocale->__variable); free(CachedRuneLocale); } CachedRuneLocale = _CurrentRuneLocale; diff --git a/lib/libc/locale/tolower.c b/lib/libc/locale/tolower.c index 04f39925c003..24a85947a4ce 100644 --- a/lib/libc/locale/tolower.c +++ b/lib/libc/locale/tolower.c @@ -45,19 +45,19 @@ ___tolower(c) __ct_rune_t c; { size_t lim; - _RuneRange *rr = &_CurrentRuneLocale->maplower_ext; + _RuneRange *rr = &_CurrentRuneLocale->__maplower_ext; _RuneEntry *base, *re; if (c < 0 || c == EOF) return(c); /* Binary search -- see bsearch.c for explanation. */ - base = rr->ranges; - for (lim = rr->nranges; lim != 0; lim >>= 1) { + base = rr->__ranges; + for (lim = rr->__nranges; lim != 0; lim >>= 1) { re = base + (lim >> 1); - if (re->min <= c && c <= re->max) - return (re->map + c - re->min); - else if (c > re->max) { + if (re->__min <= c && c <= re->__max) + return (re->__map + c - re->__min); + else if (c > re->__max) { base = re + 1; lim--; } diff --git a/lib/libc/locale/toupper.c b/lib/libc/locale/toupper.c index b83365d40130..5ceaab4aaf27 100644 --- a/lib/libc/locale/toupper.c +++ b/lib/libc/locale/toupper.c @@ -45,19 +45,19 @@ ___toupper(c) __ct_rune_t c; { size_t lim; - _RuneRange *rr = &_CurrentRuneLocale->mapupper_ext; + _RuneRange *rr = &_CurrentRuneLocale->__mapupper_ext; _RuneEntry *base, *re; if (c < 0 || c == EOF) return(c); /* Binary search -- see bsearch.c for explanation. */ - base = rr->ranges; - for (lim = rr->nranges; lim != 0; lim >>= 1) { + base = rr->__ranges; + for (lim = rr->__nranges; lim != 0; lim >>= 1) { re = base + (lim >> 1); - if (re->min <= c && c <= re->max) - return (re->map + c - re->min); - else if (c > re->max) { + if (re->__min <= c && c <= re->__max) + return (re->__map + c - re->__min); + else if (c > re->__max) { base = re + 1; lim--; } |