path: root/src/locale
diff options
authorRich Felker <>2018-09-10 23:26:40 -0400
committerRich Felker <>2018-09-12 14:34:33 -0400
commit13d1afa46f8098df290008c681816c9eb89ffbdb (patch)
tree01ec1581298b49f20848f9c5ce61bfa9bccd7e1a /src/locale
parent8c1ac426e15b27d2879afa26a500fd80010b33b9 (diff)
overhaul internally-public declarations using wrapper headers
commits leading up to this one have moved the vast majority of libc-internal interface declarations to appropriate internal headers, allowing them to be type-checked and setting the stage to limit their visibility. the ones that have not yet been moved are mostly namespace-protected aliases for standard/public interfaces, which exist to facilitate implementing plain C functions in terms of POSIX functionality, or C or POSIX functionality in terms of extensions that are not standardized. some don't quite fit this description, but are "internally public" interfacs between subsystems of libc. rather than create a number of newly-named headers to declare these functions, and having to add explicit include directives for them to every source file where they're needed, I have introduced a method of wrapping the corresponding public headers. parallel to the public headers in $(srcdir)/include, we now have wrappers in $(srcdir)/src/include that come earlier in the include path order. they include the public header they're wrapping, then add declarations for namespace-protected versions of the same interfaces and any "internally public" interfaces for the subsystem they correspond to. along these lines, the wrapper for features.h is now responsible for the definition of the hidden, weak, and weak_alias macros. this means source files will no longer need to include any special headers to access these features. over time, it is my expectation that the scope of what is "internally public" will expand, reducing the number of source files which need to include *_impl.h and related headers down to those which are actually implementing the corresponding subsystems, not just using them.
Diffstat (limited to 'src/locale')
3 files changed, 2 insertions, 9 deletions
diff --git a/src/locale/dcngettext.c b/src/locale/dcngettext.c
index de0828d9..fc1018df 100644
--- a/src/locale/dcngettext.c
+++ b/src/locale/dcngettext.c
@@ -4,6 +4,7 @@
#include <errno.h>
#include <limits.h>
#include <sys/stat.h>
+#include <sys/mman.h>
#include <ctype.h>
#include "locale_impl.h"
#include "libc.h"
@@ -113,9 +114,6 @@ static char *dummy_gettextdomain()
weak_alias(dummy_gettextdomain, __gettextdomain);
-const unsigned char *__map_file(const char *, size_t *);
-int __munmap(void *, size_t);
char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long int n, int category)
static struct msgcat *volatile cats;
diff --git a/src/locale/locale_map.c b/src/locale/locale_map.c
index 79542310..e7b518a1 100644
--- a/src/locale/locale_map.c
+++ b/src/locale/locale_map.c
@@ -1,5 +1,6 @@
#include <locale.h>
#include <string.h>
+#include <sys/mman.h>
#include "locale_impl.h"
#include "libc.h"
#include "atomic.h"
@@ -11,10 +12,6 @@ const char *__lctrans_impl(const char *msg, const struct __locale_map *lm)
return trans ? trans : msg;
-const unsigned char *__map_file(const char *, size_t *);
-int __munmap(void *, size_t);
-char *__strchrnul(const char *, int);
static const char envvars[][12] = {
diff --git a/src/locale/setlocale.c b/src/locale/setlocale.c
index 40bc7ece..60e3353c 100644
--- a/src/locale/setlocale.c
+++ b/src/locale/setlocale.c
@@ -17,8 +17,6 @@ static char *setlocale_one_unlocked(int cat, const char *name)
return lm ? (char *)lm->name : "C";
-char *__strchrnul(const char *, int);
char *setlocale(int cat, const char *name)
static volatile int lock[1];