freelocale Subroutine

Purpose

Frees resources allocated for a locale object.

Library

Standard C Library (libc.a)

Syntax

#include <locale.h>
void freelocale(locobj);
locale_t locobj;

Return Value

None

Errors

None

Description

The freelocale subroutine releases the resources allocated for a locale object that is returned by a call to the newlocale or duplocale subroutines.

Any use of a locale object that has been freed results in undefined behavior.

Example

The following example shows a code snippets to free a locale object created by the newlocale subroutine:

#include <locale.h>
...
/* Every locale object allocated with newlocale() should be
* freed using freelocale():
*/

locale_t loc;
/* Get the locale. */

loc = newlocale (LC_CTYPE_MASK | LC_TIME_MASK, "locname", NULL);
/* ... Use the locale object ... */
...

/* Free the locale object resources. */
freelocale (loc);