diff options
| author | Ed Schouten <ed@FreeBSD.org> | 2016-07-29 17:18:47 +0000 |
|---|---|---|
| committer | Ed Schouten <ed@FreeBSD.org> | 2016-07-29 17:18:47 +0000 |
| commit | 718fe473dd6e95d8258043478cab40661ec00a3f (patch) | |
| tree | 65b38bf569fa9acbb4da1ca63f64db75dfb50e1e | |
| parent | 6bd57d14ed207b6b5aa94f81b8bef29bc52b8518 (diff) | |
Notes
| -rw-r--r-- | include/xlocale/_locale.h | 2 | ||||
| -rw-r--r-- | lib/libc/locale/freelocale.3 | 17 | ||||
| -rw-r--r-- | lib/libc/locale/xlocale.c | 22 |
3 files changed, 15 insertions, 26 deletions
diff --git a/include/xlocale/_locale.h b/include/xlocale/_locale.h index f8aafb8a1ba91..adbfb92427546 100644 --- a/include/xlocale/_locale.h +++ b/include/xlocale/_locale.h @@ -48,7 +48,7 @@ typedef struct _xlocale *locale_t; #endif locale_t duplocale(locale_t base); -int freelocale(locale_t loc); +void freelocale(locale_t loc); locale_t newlocale(int mask, const char *locale, locale_t base); const char *querylocale(int mask, locale_t loc); locale_t uselocale(locale_t loc); diff --git a/lib/libc/locale/freelocale.3 b/lib/libc/locale/freelocale.3 index 0df80e7892cdb..d3e2d4498226a 100644 --- a/lib/libc/locale/freelocale.3 +++ b/lib/libc/locale/freelocale.3 @@ -26,7 +26,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd September 17, 2011 +.Dd July 26, 2016 .Dt FREELOCALE 3 .Os .Sh NAME @@ -39,7 +39,7 @@ or .Lb libc .Sh SYNOPSIS .In locale.h -.Ft int +.Ft void .Fn freelocale "locale_t locale" .Sh DESCRIPTION Frees a @@ -47,8 +47,6 @@ Frees a This relinquishes any resources held exclusively by this locale. Note that locales share reference-counted components, so a call to this function is not guaranteed to free all of the components. -.Sh RETURN VALUES -Returns 0 on success or -1 on error. .Sh SEE ALSO .Xr duplocale 3 , .Xr localeconv 3 , @@ -57,12 +55,5 @@ Returns 0 on success or -1 on error. .Xr uselocale 3 , .Xr xlocale 3 .Sh STANDARDS -The -.Fn freelocale -function -differs from -.St -p1003.1-2008 -in that its return type is -.Vt int -rather than -.Vt void . +This function conforms to +.St -p1003.1-2008 . diff --git a/lib/libc/locale/xlocale.c b/lib/libc/locale/xlocale.c index f9b7db107aecc..a005f0fca7e3e 100644 --- a/lib/libc/locale/xlocale.c +++ b/lib/libc/locale/xlocale.c @@ -325,20 +325,18 @@ locale_t duplocale(locale_t base) * Free a locale_t. This is quite a poorly named function. It actually * disclaims a reference to a locale_t, rather than freeing it. */ -int +void freelocale(locale_t loc) { - /* Fail if we're passed something that isn't a locale. */ - if ((NULL == loc) || (LC_GLOBAL_LOCALE == loc)) { - return (-1); - } - /* If we're passed the global locale, pretend that we freed it but don't - * actually do anything. */ - if (&__xlocale_global_locale == loc) { - return (0); - } - xlocale_release(loc); - return (0); + + /* + * Fail if we're passed something that isn't a locale. If we're + * passed the global locale, pretend that we freed it but don't + * actually do anything. + */ + if (loc != NULL && loc != LC_GLOBAL_LOCALE && + loc != &__xlocale_global_locale) + xlocale_release(loc); } /* |
