Skip to content

Commit 39f1d65

Browse files
committed
locale: Switch locale from a struct to an int
As the only thing locale controls is LC_CTYPE, get rid of the struct and replace it with just the LC_CTYPE value. Represent the locale as an 'int' in the API to avoid ABI compatibility issues with enums. Because (locale_t) 0 is a special return value from newlocale, shift all locale ids up by one, leaving 0 for the error return. Use that for locale_INVALID. Signed-off-by: Keith Packard <[email protected]>
1 parent 5cc6157 commit 39f1d65

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+290
-302
lines changed

newlib/libc/ctype/caseconv.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static const struct caseconv_entry table [] = {
1919

2020
/* auxiliary function for binary search in interval properties table */
2121
const struct caseconv_entry *
22-
__caseconv_lookup (wint_t ucs, struct __locale_t *locale)
22+
__caseconv_lookup (wint_t ucs, locale_t locale)
2323
{
2424
size_t min = 0;
2525
size_t max = NCASECONV-1;

newlib/libc/ctype/ctype_table.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static struct {
5151
#define N_CAT_TABLE (sizeof(ctype_table) / sizeof(ctype_table[0]))
5252

5353
uint16_t
54-
__ctype_table_lookup(wint_t ic, struct __locale_t *locale)
54+
__ctype_table_lookup(wint_t ic, locale_t locale)
5555
{
5656
size_t low = 0;
5757
size_t high = N_CAT_TABLE - 1;

newlib/libc/ctype/isalnum_l.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling
77

88
#undef isalnum_l
99
int
10-
isalnum_l (int c, struct __locale_t *locale)
10+
isalnum_l (int c, locale_t locale)
1111
{
1212
#if _PICOLIBC_CTYPE_SMALL
1313
(void) locale;

newlib/libc/ctype/isalpha_l.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling
77

88
#undef isalpha_l
99
int
10-
isalpha_l (int c, struct __locale_t *locale)
10+
isalpha_l (int c, locale_t locale)
1111
{
1212
#if _PICOLIBC_CTYPE_SMALL
1313
(void) locale;

newlib/libc/ctype/isascii_l.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling
77

88
#undef isascii_l
99
int
10-
isascii_l (int c, struct __locale_t *locale)
10+
isascii_l (int c, locale_t locale)
1111
{
1212
(void) locale;
1313
return (unsigned) c <= 0177;

newlib/libc/ctype/isblank_l.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling
77

88
#undef isblank_l
99
int
10-
isblank_l (int c, struct __locale_t *locale)
10+
isblank_l (int c, locale_t locale)
1111
{
1212
#if _PICOLIBC_CTYPE_SMALL
1313
(void) locale;

newlib/libc/ctype/iscntrl_l.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling
77

88
#undef iscntrl_l
99
int
10-
iscntrl_l (int c, struct __locale_t *locale)
10+
iscntrl_l (int c, locale_t locale)
1111
{
1212
(void) locale;
1313
#if _PICOLIBC_CTYPE_SMALL

newlib/libc/ctype/isdigit_l.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling
77

88
#undef isdigit_l
99
int
10-
isdigit_l (int c, struct __locale_t *locale)
10+
isdigit_l (int c, locale_t locale)
1111
{
1212
#if _PICOLIBC_CTYPE_SMALL
1313
(void) locale;

newlib/libc/ctype/isgraph_l.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling
88

99
#undef isgraph_l
1010
int
11-
isgraph_l (int c, struct __locale_t *locale)
11+
isgraph_l (int c, locale_t locale)
1212
{
1313
#if _PICOLIBC_CTYPE_SMALL
1414
(void) locale;

newlib/libc/ctype/islower_l.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling
77

88
#undef islower_l
99
int
10-
islower_l (int c, struct __locale_t *locale)
10+
islower_l (int c, locale_t locale)
1111
{
1212
#if _PICOLIBC_CTYPE_SMALL
1313
(void) locale;

0 commit comments

Comments
 (0)