Deleted Added
full compact
lnumeric.c (72283) lnumeric.c (72321)
1/*
2 * Copyright (c) 2000, 2001 Alexey Zelkin
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*
2 * Copyright (c) 2000, 2001 Alexey Zelkin
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/lib/libc/locale/lnumeric.c 72283 2001-02-10 03:31:23Z ache $
26 * $FreeBSD: head/lib/libc/locale/lnumeric.c 72321 2001-02-10 15:36:46Z phantom $
27 */
28
27 */
28
29#include <limits.h>
29#include "lnumeric.h"
30#include "ldpart.h"
31
32extern int __nlocale_changed;
30#include "lnumeric.h"
31#include "ldpart.h"
32
33extern int __nlocale_changed;
34extern const char * __fix_locale_grouping_str(const char *);
33
34#define LCNUMERIC_SIZE (sizeof(struct lc_numeric_T) / sizeof(char *))
35
35
36#define LCNUMERIC_SIZE (sizeof(struct lc_numeric_T) / sizeof(char *))
37
36static char numempty[] = "-1";
38static char numempty[] = { CHAR_MAX, '\0' };
37
38static const struct lc_numeric_T _C_numeric_locale = {
39 ".", /* decimal_point */
40 "", /* thousands_sep */
41 numempty /* grouping */
42};
43
44static struct lc_numeric_T _numeric_locale;
45static int _numeric_using_locale;
46static char * numeric_locale_buf;
47
48int
49__numeric_load_locale(const char *name) {
50
51 int ret;
52
39
40static const struct lc_numeric_T _C_numeric_locale = {
41 ".", /* decimal_point */
42 "", /* thousands_sep */
43 numempty /* grouping */
44};
45
46static struct lc_numeric_T _numeric_locale;
47static int _numeric_using_locale;
48static char * numeric_locale_buf;
49
50int
51__numeric_load_locale(const char *name) {
52
53 int ret;
54
55 __nlocale_changed = 1;
53 ret = __part_load_locale(name, &_numeric_using_locale,
54 numeric_locale_buf, "LC_NUMERIC", LCNUMERIC_SIZE,
55 (const char **)&_numeric_locale);
56 if (!ret)
56 ret = __part_load_locale(name, &_numeric_using_locale,
57 numeric_locale_buf, "LC_NUMERIC", LCNUMERIC_SIZE,
58 (const char **)&_numeric_locale);
59 if (!ret)
57 __nlocale_changed = 1;
60 _numeric_locale.grouping =
61 __fix_locale_grouping_str(_numeric_locale.grouping);
58 return ret;
59}
60
61struct lc_numeric_T *
62__get_current_numeric_locale(void) {
63
64 return (_numeric_using_locale
65 ? &_numeric_locale

--- 15 unchanged lines hidden ---
62 return ret;
63}
64
65struct lc_numeric_T *
66__get_current_numeric_locale(void) {
67
68 return (_numeric_using_locale
69 ? &_numeric_locale

--- 15 unchanged lines hidden ---