54 |
// General helper functions. |
// General helper functions. |
55 |
|
|
56 |
struct _locale_t { |
struct _locale_t { |
57 |
char numeric[32]; |
char numeric[32+1]; |
58 |
char ctype[32]; |
char ctype[32+1]; |
59 |
}; |
}; |
60 |
|
|
61 |
// we need to ensure a constant locale setting e.g. for parsing |
// we need to ensure a constant locale setting e.g. for parsing |
63 |
// character varies by the invidual locale settings |
// character varies by the invidual locale settings |
64 |
static void _save_and_set_c_locale(struct _locale_t* locale) |
static void _save_and_set_c_locale(struct _locale_t* locale) |
65 |
{ |
{ |
66 |
|
locale->numeric[32] = locale->ctype[32] = 0; |
67 |
strncpy(locale->numeric, setlocale(LC_NUMERIC, NULL), 32); |
strncpy(locale->numeric, setlocale(LC_NUMERIC, NULL), 32); |
68 |
strncpy(locale->ctype, setlocale(LC_CTYPE, NULL), 32); |
strncpy(locale->ctype, setlocale(LC_CTYPE, NULL), 32); |
69 |
setlocale(LC_NUMERIC, "C"); |
setlocale(LC_NUMERIC, "C"); |