mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-16 19:40:07 +08:00
956565be70
Signed-off by: Corinna Vinschen <corinna@vinschen.de>
28 lines
613 B
C
28 lines
613 B
C
#include <newlib.h>
|
|
#include <reent.h>
|
|
#include <stdlib.h>
|
|
#include "setlocale.h"
|
|
|
|
void
|
|
_freelocale_r (struct _reent *p, struct __locale_t *locobj)
|
|
{
|
|
/* Sanity check. The "C" locale is static, don't try to free it. */
|
|
if (!locobj || locobj == &__C_locale || locobj == LC_GLOBAL_LOCALE)
|
|
return;
|
|
#ifdef __HAVE_LOCALE_INFO__
|
|
for (int i = 1; i < _LC_LAST; ++i)
|
|
if (locobj->lc_cat[i].buf)
|
|
{
|
|
_free_r (p, (void *) locobj->lc_cat[i].ptr);
|
|
_free_r (p, locobj->lc_cat[i].buf);
|
|
}
|
|
#endif
|
|
_free_r (p, locobj);
|
|
}
|
|
|
|
void
|
|
freelocale (struct __locale_t *locobj)
|
|
{
|
|
_freelocale_r (_REENT, locobj);
|
|
}
|