diff --git a/libs/libc/locale/lib_localeconv.c b/libs/libc/locale/lib_localeconv.c index d1512f8014d..b23a7bc1a34 100644 --- a/libs/libc/locale/lib_localeconv.c +++ b/libs/libc/locale/lib_localeconv.c @@ -44,6 +44,38 @@ #ifdef CONFIG_LIBC_LOCALE +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static struct lconv g_c_lconv = +{ + .decimal_point = ".", + .thousands_sep = "", + .grouping = "", + .int_curr_symbol = "", + .currency_symbol = "", + .mon_decimal_point = "", + .mon_thousands_sep = "", + .mon_grouping = "", + .positive_sign = "", + .negative_sign = "", + .int_frac_digits = CHAR_MAX, + .frac_digits = CHAR_MAX, + .p_cs_precedes = CHAR_MAX, + .p_sep_by_space = CHAR_MAX, + .n_cs_precedes = CHAR_MAX, + .n_sep_by_space = CHAR_MAX, + .p_sign_posn = CHAR_MAX, + .n_sign_posn = CHAR_MAX, + .int_p_cs_precedes = CHAR_MAX, + .int_p_sep_by_space = CHAR_MAX, + .int_n_cs_precedes = CHAR_MAX, + .int_n_sep_by_space = CHAR_MAX, + .int_p_sign_posn = CHAR_MAX, + .int_n_sign_posn = CHAR_MAX, +}; + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -62,8 +94,6 @@ FAR struct lconv *localeconv(void) { - /* NULL indicates the locale was not changed */ - - return NULL; + return &g_c_lconv; } #endif diff --git a/libs/libc/locale/lib_setlocale.c b/libs/libc/locale/lib_setlocale.c index e037d714ec0..4b3344eb0bb 100644 --- a/libs/libc/locale/lib_setlocale.c +++ b/libs/libc/locale/lib_setlocale.c @@ -63,12 +63,7 @@ FAR char *setlocale(int category, FAR const char *locale) { - if (locale == NULL) - { - return NULL; - } - - return ((strcmp(locale, "POSIX") == 0 || strcmp(locale, "C") == 0 || - strcmp(locale, "") == 0) ? "C" : NULL); + return ((locale == NULL || strcmp(locale, "POSIX") == 0 || + strcmp(locale, "C") == 0 || strcmp(locale, "") == 0) ? "C" : NULL); } #endif