1 --- ldpart.c.orig 2008-06-03 18:15:42.000000000 -0700
2 +++ ldpart.c 2008-06-18 13:23:20.000000000 -0700
5 __FBSDID("$FreeBSD: src/lib/libc/locale/ldpart.c,v 1.15 2004/04/25 19:56:50 ache Exp $");
7 +#include "xlocale_private.h"
10 #include <sys/types.h>
12 @@ -44,9 +46,9 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/
14 static int split_lines(char *, const char *);
17 +__private_extern__ int
18 __part_load_locale(const char *name,
20 + unsigned char *using_locale,
22 const char *category_filename,
23 int locale_buf_size_max,
24 @@ -60,20 +62,6 @@ __part_load_locale(const char *name,
26 size_t namesize, bufsize;
28 - /* 'name' must be already checked. */
29 - if (strcmp(name, "C") == 0 || strcmp(name, "POSIX") == 0) {
31 - return (_LDP_CACHE);
35 - * If the locale name is the same as our cache, use the cache.
37 - if (*locale_buf != NULL && strcmp(name, *locale_buf) == 0) {
39 - return (_LDP_CACHE);
43 * Slurp the locale file into the cache.
45 @@ -115,9 +103,7 @@ __part_load_locale(const char *name,
46 num_lines = split_lines(p, plim);
47 if (num_lines >= locale_buf_size_max)
48 num_lines = locale_buf_size_max;
49 - else if (num_lines >= locale_buf_size_min)
50 - num_lines = locale_buf_size_min;
52 + else if (num_lines < locale_buf_size_min) {
56 @@ -164,3 +150,9 @@ split_lines(char *p, const char *plim)
60 +__private_extern__ void
61 +__ldpart_free_extra(struct __xlocale_st_ldpart *lp)
64 + free(lp->_locale_buf);