| 1 |
/* Return name of a single locale category. |
| 2 |
Copyright (C) 2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is free software: you can redistribute it and/or modify |
| 5 |
it under the terms of the GNU Lesser General Public License as |
| 6 |
published by the Free Software Foundation; either version 2.1 of the |
| 7 |
License, or (at your option) any later version. |
| 8 |
|
| 9 |
This file is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
GNU Lesser General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU Lesser General Public License |
| 15 |
along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| 16 |
|
| 17 |
/* Written by Bruno Haible <[email protected]>, 2025. */ |
| 18 |
|
| 19 |
#ifndef _GETLOCALENAME_L_UNSAFE_H |
| 20 |
#define _GETLOCALENAME_L_UNSAFE_H |
| 21 |
|
| 22 |
#include <locale.h> |
| 23 |
|
| 24 |
#include "arg-nonnull.h" |
| 25 |
|
| 26 |
#ifdef __cplusplus |
| 27 |
extern "C" { |
| 28 |
#endif |
| 29 |
|
| 30 |
|
| 31 |
/* This enumeration describes the storage of the return value. */ |
| 32 |
enum storage |
| 33 |
{ |
| 34 |
/* Storage with indefinite extent. */ |
| 35 |
STORAGE_INDEFINITE, |
| 36 |
/* Storage in a thread-independent location, valid until the next setlocale() |
| 37 |
call. */ |
| 38 |
STORAGE_GLOBAL, |
| 39 |
/* Storage in a thread-local buffer, valid until the next |
| 40 |
getlocalename_l_unlocked() call in the same thread. */ |
| 41 |
STORAGE_THREAD, |
| 42 |
/* Storage in or attached to the locale_t object, valid until the next call |
| 43 |
to newlocale() with that object as base or until the next freelocale() call |
| 44 |
for that object. */ |
| 45 |
STORAGE_OBJECT |
| 46 |
}; |
| 47 |
|
| 48 |
/* Return type of getlocalename_l_unlocked. */ |
| 49 |
struct string_with_storage |
| 50 |
{ |
| 51 |
const char *value; |
| 52 |
enum storage storage; |
| 53 |
}; |
| 54 |
|
| 55 |
/* Returns the name of the locale category CATEGORY in the given LOCALE object |
| 56 |
or, if LOCALE is LC_GLOBAL_LOCALE, in the global locale. |
| 57 |
CATEGORY must be != LC_ALL. */ |
| 58 |
extern struct string_with_storage |
| 59 |
getlocalename_l_unsafe (int category, locale_t locale) |
| 60 |
_GL_ARG_NONNULL ((2)); |
| 61 |
|
| 62 |
|
| 63 |
#ifdef __cplusplus |
| 64 |
} |
| 65 |
#endif |
| 66 |
|
| 67 |
#endif /* _GETLOCALENAME_L_UNSAFE_H */ |