Date: Tue, 2 Sep 2008 09:25:55 GMT From: Konrad Jankowski <konrad@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 149055 for review Message-ID: <200809020925.m829PtFU055374@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=149055 Change 149055 by konrad@vspredator on 2008/09/02 09:25:40 Throw out the endianness dance from libc's collate.c Affected files ... .. //depot/projects/soc2008/konrad_collation/libc/locale/collate.c#11 edit Differences ... ==== //depot/projects/soc2008/konrad_collation/libc/locale/collate.c#11 (text+ko) ==== @@ -54,9 +54,6 @@ #include "libc_private.h" -#if _BYTE_ORDER == _LITTLE_ENDIAN -static void wntohl(wchar_t *, int); -#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ void __collate_err(int ex, const char *f) __dead2; #undef __collate_load_error @@ -113,14 +110,6 @@ } if (fread(&info, sizeof(info), 1, fp) != 1) goto error_close_and_return; -#if _BYTE_ORDER == _LITTLE_ENDIAN - for(z = 0; z < info.directive_count; z++) { - info.undef_pri.pri[z] = ntohl(info.undef_pri.pri[z]); - info.subst_count[z] = ntohl(info.subst_count[z]); - } - info.chain_count = ntohl(info.chain_count); - info.large_pri_count = ntohl(info.large_pri_count); -#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ if ((chains = info.chain_count) < 0) { #ifdef LOCALE_DEBUG fprintf(stderr, "__collate_load_tables: wrong chain count (%d)\n", @@ -181,42 +170,6 @@ else TMP->__large_char_pri_table = NULL; -#if _BYTE_ORDER == _LITTLE_ENDIAN - { - struct __collate_st_char_pri *p = TMP->__char_pri_table; - for(i = UCHAR_MAX + 1; i-- > 0; p++) { - for(z = 0; z < info.directive_count; z++) - p->pri[z] = ntohl(p->pri[z]); - } - } - for(z = 0; z < info.directive_count; z++) - if (info.subst_count[z] > 0) { - struct __collate_st_subst *p = - TMP->__substitute_table[z]; - for(i = info.subst_count[z]; i-- > 0; p++) { - p->val = ntohl(p->val); - wntohl(p->str, STR_LEN); - } - } - { - struct __collate_st_chain_pri *p = TMP->__chain_pri_table; - - for(i = chains; i-- > 0; p++) { - wntohl(p->str, STR_LEN); - for(z = 0; z < info.directive_count; z++) - p->pri.pri[z] = ntohl(p->pri.pri[z]); - } - } - if (info.large_pri_count > 0) { - struct __collate_st_large_char_pri *p = - TMP->__large_char_pri_table; - for(i = info.large_pri_count; i-- > 0; p++) { - p->val = ntohl(p->val); - for(z = 0; z < info.directive_count; z++) - p->pri.pri[z] = ntohl(p->pri.pri[z]); - } - } -#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ (void)strcpy(TMP->__encoding, encoding); (void)memcpy(&TMP->__info, &info, sizeof(info)); __collate_data = TMP; @@ -854,15 +807,6 @@ return len; } -#if _BYTE_ORDER == _LITTLE_ENDIAN -static void -wntohl(wchar_t *str, int len) -{ - for(; *str && len > 0; str++, len--) - *str = ntohl(*str); -} -#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */ - #ifdef COLLATE_DEBUG static char * show(int c) @@ -898,7 +842,6 @@ __collate_print_tables() { int i, z; - locale_t loc = __current_locale(); printf("Info: p=%d s=%d f=0x%02x m=%d dc=%d up=%d us=%d pc=%d " "sc=%d cc=%d lc=%d\n",
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809020925.m829PtFU055374>