From 43eb269ab1d216074e18dadc74c9671398dfe938 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Tue, 20 May 2008 20:32:27 +0000 Subject: getopt: do not needlessly use static structure. Reorder structure members and change some of them into smallints to reduce bss and text: text data bss dec hex filename - 2403 12 40 2455 997 libc/unistd/getopt.o + 2252 12 0 2264 8d8 libc/unistd/getopt.o --- libc/unistd/getopt.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'libc/unistd/getopt.c') diff --git a/libc/unistd/getopt.c b/libc/unistd/getopt.c index 754e86f25..c28afda0d 100644 --- a/libc/unistd/getopt.c +++ b/libc/unistd/getopt.c @@ -162,10 +162,6 @@ int opterr = 1; int optopt = '?'; -/* Keep a global copy of all internal members of getopt_data. */ - -static struct _getopt_data getopt_data; - #ifndef __GNU_LIBRARY__ @@ -1158,7 +1154,9 @@ _getopt_internal (int argc, char *const *argv, const char *optstring, const struct option *longopts, int *longind, int long_only) { int result; + struct _getopt_data getopt_data; + memset(&getopt_data, 0, sizeof(getopt_data)); getopt_data.optind = optind; getopt_data.opterr = opterr; -- cgit v1.2.3