3 <<freelocale>>---free resources allocated for a locale object
13 locale_t freelocale(locale_t <[locobj]>);
15 locale_t _freelocale_r(void *<[reent]>, locale_t <[locobj]>);
18 The <<freelocale>> function shall cause the resources allocated for a
19 locale object returned by a call to the <<newlocale>> or <<duplocale>>
20 functions to be released.
22 The behavior is undefined if the <[locobj]> argument is the special locale
23 object LC_GLOBAL_LOCALE or is not a valid locale object handle.
25 Any use of a locale object that has been freed results in undefined
32 <<freelocale>> is POSIX-1.2008.
38 #include "setlocale.h"
41 _freelocale_r (struct _reent
*p
, struct __locale_t
*locobj
)
43 /* Nothing to do on !_MB_CAPABLE targets. */
45 /* Sanity check. The "C" locale is static, don't try to free it. */
46 if (!locobj
|| locobj
== __get_C_locale () || locobj
== LC_GLOBAL_LOCALE
)
48 #ifdef __HAVE_LOCALE_INFO__
49 for (int i
= 1; i
< _LC_LAST
; ++i
)
50 if (locobj
->lc_cat
[i
].buf
)
52 _free_r (p
, (void *) locobj
->lc_cat
[i
].ptr
);
53 _free_r (p
, locobj
->lc_cat
[i
].buf
);
55 #endif /* __HAVE_LOCALE_INFO__ */
57 #endif /* _MB_CAPABLE */
61 freelocale (struct __locale_t
*locobj
)
63 _freelocale_r (_REENT
, locobj
);