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 (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without
*** 41,51 **** #include "setlocale.h" static int split_lines(char *, const char *); int ! __part_load_locale(const char *name, int *using_locale, char **locale_buf, const char *category_filename, int locale_buf_size_max, int locale_buf_size_min, const char **dst_localebuf) { int saverr, fd, i, num_lines; --- 42,52 ---- #include "setlocale.h" static int split_lines(char *, const char *); int ! __part_load_locale(const char *name, char **locale_buf, const char *category_filename, int locale_buf_size_max, int locale_buf_size_min, const char **dst_localebuf) { int saverr, fd, i, num_lines;
*** 53,77 **** const char *plim; char filename[PATH_MAX]; struct stat st; size_t namesize, bufsize; - /* 'name' must be already checked. */ - if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) { - *using_locale = 0; - return (_LDP_CACHE); - } - /* - * If the locale name is the same as our cache, use the cache. - */ - if (*locale_buf != NULL && strcmp(name, *locale_buf) == 0) { - *using_locale = 1; - return (_LDP_CACHE); - } - - /* * Slurp the locale file into the cache. */ namesize = strlen(name) + 1; /* 'PathLocale' must be already set & checked. */ --- 54,64 ----
*** 115,132 **** } (void) close(fd); /* * Record the successful parse in the cache. */ - if (*locale_buf != NULL) - free(*locale_buf); *locale_buf = lbuf; for (p = *locale_buf, i = 0; i < num_lines; i++) dst_localebuf[i] = (p += strlen(p) + 1); for (i = num_lines; i < locale_buf_size_max; i++) dst_localebuf[i] = NULL; - *using_locale = 1; return (_LDP_LOADED); bad_lbuf: saverr = errno; --- 102,116 ----