Yank some unnecessarily exported global variables that should be static.
diff --git a/lib/portability.c b/lib/portability.c
index 3e5520c..a175b34 100644
--- a/lib/portability.c
+++ b/lib/portability.c
@@ -457,7 +457,6 @@
// Non-POSIX signals that don't cause termination
SIGNIFY(WINCH),
};
-int signames_len = ARRAY_LEN(signames);
#undef SIGNIFY
@@ -511,7 +510,7 @@
int i;
// A named signal?
- for (i=0; i<signames_len; i++)
+ for (i=0; i<ARRAY_LEN(signames); i++)
if (signames[i].num == sig) return signames[i].name;
// A real-time signal?
diff --git a/scripts/findglobals.sh b/scripts/findglobals.sh
index 2c63164..2bb94d6 100755
--- a/scripts/findglobals.sh
+++ b/scripts/findglobals.sh
@@ -3,4 +3,4 @@
# Quick and dirty check to see if anybody's leaked global variables.
# We should have this, toy_list, toybuf, and toys.
-nm toybox_unstripped | grep '[0-9A-Fa-f]* [BCDGRS]' | cut -d ' ' -f 3
+nm --size-sort generated/unstripped/toybox | grep '[0-9A-Fa-f]* [BCDGRS]' #| cut -d ' ' -f 3
diff --git a/toys/other/chrt.c b/toys/other/chrt.c
index 11b4f33..1a8222f 100644
--- a/toys/other/chrt.c
+++ b/toys/other/chrt.c
@@ -47,7 +47,7 @@
syscall(SYS_sched_setscheduler, (pid_t)pid, (int)scheduler, (void *)param)
#endif
-char *polnames[] = {
+static char *polnames[] = {
"SCHED_OTHER", "SCHED_FIFO", "SCHED_RR", "SCHED_BATCH", 0, "SCHED_IDLE",
"SCHED_DEADLINE"
};
diff --git a/toys/posix/getconf.c b/toys/posix/getconf.c
index c5e0548..a8017b2 100644
--- a/toys/posix/getconf.c
+++ b/toys/posix/getconf.c
@@ -55,7 +55,7 @@
// confstr(), or output the macro value directly.
// Probe the live system
-struct config sysconfs[] = {
+static struct config sysconfs[] = {
/* POSIX */
#define CONF(n) {"_POSIX_" #n,_SC_ ## n}
CONF(ADVISORY_INFO), CONF(BARRIERS), CONF(ASYNCHRONOUS_IO),
@@ -118,7 +118,7 @@
};
// Probe the live system with a path
-struct config pathconfs[] = {
+static struct config pathconfs[] = {
#undef CONF
#define CONF(n) {#n,_PC_ ## n}
CONF(ASYNC_IO), CONF(CHOWN_RESTRICTED), CONF(FILESIZEBITS), CONF(LINK_MAX),
@@ -129,14 +129,14 @@
};
// Strings out of a header
-struct config confstrs[] = {
+static struct config confstrs[] = {
#undef CONF
#define CONF(n) {#n,_CS_ ## n}
CONF(PATH), CONF(V7_ENV)
};
// Integers out of a header
-struct config limits[] = {
+static struct config limits[] = {
#undef CONF
#define CONF(n) {#n,n}
CONF(_POSIX_AIO_LISTIO_MAX), CONF(_POSIX_AIO_MAX), CONF(_POSIX_ARG_MAX),
@@ -167,7 +167,7 @@
};
// Names we need to handle ourselves (default to blank but shouldn't error)
-struct config others[] = {
+static struct config others[] = {
{"LFS_CFLAGS", 0}, {"LFS_LDFLAGS", 0}, {"LFS_LIBS", 0}
};