From 1f04a45950ad1bf0dd52f8067d3b76afa3be8355 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 22 Oct 2017 20:01:07 +0000 Subject: [PATCH] libc: Do not refer to _DefaultRuneLocale in ctype inlines Referring to _DefaultRuneLocale causes this >4KB structure to be copied to all executables that use inlines (except PIE executables). This only affects the case where thread local storage is available. _CurrentRuneLocale cannot be NULL, so the check can be removed entirely. _DefaultRuneLocale needs to remain available for now since libc++ uses it. The __isctype inline in include/_ctype.h also refers to _DefaultRuneLocale and remains available because it may still be used by third party software. Reviewed by: bdrewery, theraven Differential Revision: https://reviews.freebsd.org/D10363 --- include/runetype.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/include/runetype.h b/include/runetype.h index 6aad915b5604..dcbb226bb2d8 100644 --- a/include/runetype.h +++ b/include/runetype.h @@ -95,9 +95,7 @@ static __inline const _RuneLocale *__getCurrentRuneLocale(void) if (_ThreadRuneLocale) return _ThreadRuneLocale; - if (_CurrentRuneLocale) - return _CurrentRuneLocale; - return &_DefaultRuneLocale; + return _CurrentRuneLocale; } #endif /* __NO_TLS || __RUNETYPE_INTERNAL */ #define _CurrentRuneLocale (__getCurrentRuneLocale())