From owner-svn-src-all@freebsd.org Fri Jul 29 17:18:49 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34DF0BA85E5; Fri, 29 Jul 2016 17:18:49 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FFBE1A52; Fri, 29 Jul 2016 17:18:48 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6THImhv082941; Fri, 29 Jul 2016 17:18:48 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6THIm7R082938; Fri, 29 Jul 2016 17:18:48 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201607291718.u6THIm7R082938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Fri, 29 Jul 2016 17:18:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r303495 - in head: include/xlocale lib/libc/locale X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jul 2016 17:18:49 -0000 Author: ed Date: Fri Jul 29 17:18:47 2016 New Revision: 303495 URL: https://svnweb.freebsd.org/changeset/base/303495 Log: Change the return type of freelocale(3) to void. Our version of this function currently returns an integer indicating failure or success, whereas POSIX specifies that this function has no return value. It returns void. Patch up the header, sources and man page to use the right type. While there, use the opportunity to simplify the body of this function. Theoretically speaking, this change breaks the ABI of this function. That said, I have yet to find any code that makes use of freelocale()'s return value. I couldn't find any of it in the base system, nor did an exp-run reveal any breakage caused by this change. PR: 211394 (exp-run) Modified: head/include/xlocale/_locale.h head/lib/libc/locale/freelocale.3 head/lib/libc/locale/xlocale.c Modified: head/include/xlocale/_locale.h ============================================================================== --- head/include/xlocale/_locale.h Fri Jul 29 17:15:41 2016 (r303494) +++ head/include/xlocale/_locale.h Fri Jul 29 17:18:47 2016 (r303495) @@ -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); Modified: head/lib/libc/locale/freelocale.3 ============================================================================== --- head/lib/libc/locale/freelocale.3 Fri Jul 29 17:15:41 2016 (r303494) +++ head/lib/libc/locale/freelocale.3 Fri Jul 29 17:18:47 2016 (r303495) @@ -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 . Modified: head/lib/libc/locale/xlocale.c ============================================================================== --- head/lib/libc/locale/xlocale.c Fri Jul 29 17:15:41 2016 (r303494) +++ head/lib/libc/locale/xlocale.c Fri Jul 29 17:18:47 2016 (r303495) @@ -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); } /*