X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/9385eb3d10ebe5eb398c52040ec3dbfba9b0cdcf..2be56ee90c5c5bee77895b8787a43e894249002b:/locale/FreeBSD/fix_grouping.c diff --git a/locale/FreeBSD/fix_grouping.c b/locale/FreeBSD/fix_grouping.c index 7af4e41..180c800 100644 --- a/locale/FreeBSD/fix_grouping.c +++ b/locale/FreeBSD/fix_grouping.c @@ -25,21 +25,25 @@ */ #include -__FBSDID("$FreeBSD: src/lib/libc/locale/fix_grouping.c,v 1.7 2002/03/22 21:52:18 obrien Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/locale/fix_grouping.c,v 1.8 2003/06/26 10:46:16 phantom Exp $"); #include #include #include -static const char nogrouping[] = { CHAR_MAX, '\0' }; +static const char nogrouping[] = { '\0' }; +static const char __nogrouping[] = { CHAR_MAX, '\0' }; /* - * "3;3;-1" -> "\003\003\177" + * Internal helper used to convert grouping sequences from string + * representation into POSIX specified form, i.e. + * + * "3;3;-1" -> "\003\003\177\000" */ const char * -__fix_locale_grouping_str(const char *str) { - +__fix_locale_grouping_str(const char *str) +{ char *src, *dst; char n; @@ -81,3 +85,14 @@ __fix_locale_grouping_str(const char *str) { *dst = '\0'; return str; } + +/* + * internal helpers for SUSv3 compatibility. Since "nogrouping" needs to + * be just an empty string, we provide a routine to substitute __nogrouping + * so we don't have to modify code that expects CHAR_MAX. + */ +__private_extern__ const char * +__fix_nogrouping(const char *str) +{ + return ((str == NULL || *str == '\0') ? __nogrouping : str); +}