mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Allows c++ code to compile with or without CONFIG_LIBC_LOCALE
and will generate a link error if CONFIG_LIBC_LOCALE is not defined and setlocale is referneced. With CONFIG_LIBC_LOCALE defined setlocale will act as if MB string is not supported and return "C" for POSIX. C and ""
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#include <locale.h>
|
||||
|
||||
#ifdef CONFIG_LIBC_LOCALE
|
||||
#include <string.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -62,8 +63,8 @@
|
||||
|
||||
FAR char *setlocale(int category, FAR const char *locale)
|
||||
{
|
||||
/* NULL indicates the the locale was not changed */
|
||||
|
||||
return NULL;
|
||||
return ((strcmp (locale, "POSIX") == 0 || strcmp (locale, "C") == 0 ||
|
||||
strcmp (locale, "") == 0) ? "C" : NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user