Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 05 Dec 2025 15:09:05 +0000
From:      Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav <des@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 844f76c2426d - stable/15 - libc: Simplify __get_locale()
Message-ID:  <6932f591.3423c.42090594@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=844f76c2426d079e1fafc1babb0fc087382adfbc

commit 844f76c2426d079e1fafc1babb0fc087382adfbc
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2025-11-26 16:54:52 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2025-12-05 15:08:55 +0000

    libc: Simplify __get_locale()
    
    MFC after:      1 week
    Sponsored by:   Klara, Inc.
    Reviewed by:    fuz
    Differential Revision:  https://reviews.freebsd.org/D53908
    
    (cherry picked from commit 5af240c54bd2d9548536c904e841499e1651bcc8)
---
 lib/libc/locale/xlocale_private.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/libc/locale/xlocale_private.h b/lib/libc/locale/xlocale_private.h
index ef1a8687a376..4cb323d5fa4c 100644
--- a/lib/libc/locale/xlocale_private.h
+++ b/lib/libc/locale/xlocale_private.h
@@ -200,11 +200,9 @@ extern _Thread_local locale_t __thread_locale;
  */
 static inline locale_t __get_locale(void)
 {
-
-	if (!__has_thread_locale) {
+	if (!__has_thread_locale || __thread_locale == NULL)
 		return (&__xlocale_global_locale);
-	}
-	return (__thread_locale ? __thread_locale : &__xlocale_global_locale);
+	return (__thread_locale);
 }
 
 /**


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6932f591.3423c.42090594>