summaryrefslogtreecommitdiff
path: root/src/locale/__get_locale.c
blob: 3b89377ff4041cddf48f9c225485cfeccd56c445 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "_locale.h"

/*
This implementation only supports a single, global locale. A second
implementation will be needed for POSIX.1-2008 per-thread locales.
*/

#ifdef _POSIX_SOURCE
# define DEFAULT_LOCALE "POSIX"
#else
# define DEFAULT_LOCALE "C"
#endif

struct __locale_t * __get_locale(void)
{
	static struct __locale_t l;
	static int loaded = 0;
	if (!loaded) {
		loaded = 1;
		__load_locale(&l, LC_ALL_MASK, DEFAULT_LOCALE);
	}
	return &l;
}