Print this page
2964 need POSIX 2008 locale object support
Reviewed by: Robert Mustacchi <rm@joyent.com>

*** 1,6 **** --- 1,7 ---- /* + * Copyright 2013 Garrett D'Amore <garrett@damore.org> * Copyright 2010 Nexenta Systems, Inc. All rights reserved. * Copyright 2012 Milan Jurik. All rights reserved. * Copyright (c) 1992, 1993, 1994 Henry Spencer. * Copyright (c) 1992, 1993, 1994 * The Regents of the University of California. All rights reserved.
*** 723,732 **** --- 724,734 ---- p_b_term(struct parse *p, cset *cs) { char c; wint_t start, finish; wint_t i; + locale_t loc = uselocale(NULL); /* classify what we've got */ switch ((MORE()) ? PEEK() : '\0') { case '[': c = (MORE2()) ? PEEK2() : '\0';
*** 770,789 **** } else finish = start; if (start == finish) CHadd(p, cs, start); else { ! if (_collate_load_error) { (void) REQUIRE((uch)start <= (uch)finish, REG_ERANGE); CHaddrange(p, cs, start, finish); } else { (void) REQUIRE(_collate_range_cmp(start, ! finish) <= 0, REG_ERANGE); for (i = 0; i <= UCHAR_MAX; i++) { ! if (_collate_range_cmp(start, i) <= 0 && ! _collate_range_cmp(i, finish) <= 0) CHadd(p, cs, i); } } } break; --- 772,793 ---- } else finish = start; if (start == finish) CHadd(p, cs, start); else { ! if (loc->collate->lc_is_posix) { (void) REQUIRE((uch)start <= (uch)finish, REG_ERANGE); CHaddrange(p, cs, start, finish); } else { (void) REQUIRE(_collate_range_cmp(start, ! finish, loc) <= 0, REG_ERANGE); for (i = 0; i <= UCHAR_MAX; i++) { ! if (_collate_range_cmp(start, i, loc) ! <= 0 && ! _collate_range_cmp(i, finish, loc) ! <= 0) CHadd(p, cs, i); } } } break;
*** 1365,1374 **** --- 1369,1379 ---- char *cp; int offset; char buf[MB_LEN_MAX]; size_t clen; mbstate_t mbs; + locale_t loc = uselocale(NULL); /* avoid making error situations worse */ if (p->error != 0) return;
*** 1376,1386 **** * It's not generally safe to do a ``char'' substring search on * multibyte character strings, but it's safe for at least * UTF-8 (see RFC 3629). */ if (MB_CUR_MAX > 1 && ! strcmp(_CurrentRuneLocale->__encoding, "UTF-8") != 0) return; /* find the longest OCHAR sequence in strip */ newlen = 0; offset = 0; --- 1381,1391 ---- * It's not generally safe to do a ``char'' substring search on * multibyte character strings, but it's safe for at least * UTF-8 (see RFC 3629). */ if (MB_CUR_MAX > 1 && ! strcmp(loc->runelocale->__encoding, "UTF-8") != 0) return; /* find the longest OCHAR sequence in strip */ newlen = 0; offset = 0;