From 06607b674f434b912cc5840253c376c572f2477e Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 25 May 2008 10:39:13 +0000 Subject: Slight size reduction by use of smallints/consts: - 288016 1924 7176 297116 4889c libuClibc-0.9.29.so + 287956 1924 7168 297048 48858 libuClibc-0.9.29.so --- libc/inet/gai_strerror.c | 2 +- libc/inet/getnetbyad.c | 2 +- libc/inet/getnetbynm.c | 2 +- libc/inet/getnetent.c | 4 ++-- libc/inet/getproto.c | 4 ++-- libc/inet/getservice.c | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) (limited to 'libc/inet') diff --git a/libc/inet/gai_strerror.c b/libc/inet/gai_strerror.c index c1c7b767f..61688bad9 100644 --- a/libc/inet/gai_strerror.c +++ b/libc/inet/gai_strerror.c @@ -24,7 +24,7 @@ #define N_(x) x #define _(x) x -static struct +static const struct { int code; const char *msg; diff --git a/libc/inet/getnetbyad.c b/libc/inet/getnetbyad.c index e353f245b..06b0c4bd6 100644 --- a/libc/inet/getnetbyad.c +++ b/libc/inet/getnetbyad.c @@ -23,7 +23,7 @@ libc_hidden_proto(setnetent) libc_hidden_proto(getnetent) libc_hidden_proto(endnetent) -extern int _net_stayopen attribute_hidden; +extern smallint _net_stayopen attribute_hidden; struct netent *getnetbyaddr (uint32_t net, int type) { diff --git a/libc/inet/getnetbynm.c b/libc/inet/getnetbynm.c index 92cf8777b..edb610533 100644 --- a/libc/inet/getnetbynm.c +++ b/libc/inet/getnetbynm.c @@ -25,7 +25,7 @@ libc_hidden_proto(setnetent) libc_hidden_proto(getnetent) libc_hidden_proto(endnetent) -extern int _net_stayopen attribute_hidden; +extern smallint _net_stayopen attribute_hidden; struct netent * getnetbyname(const char *name) diff --git a/libc/inet/getnetent.c b/libc/inet/getnetent.c index eacfd709d..b22cc2a5c 100644 --- a/libc/inet/getnetent.c +++ b/libc/inet/getnetent.c @@ -39,7 +39,7 @@ static const char NETDB[] = _PATH_NETWORKS; static FILE *netf = NULL; -int _net_stayopen attribute_hidden; +smallint _net_stayopen attribute_hidden; libc_hidden_proto(setnetent) void setnetent(int f) @@ -49,7 +49,7 @@ void setnetent(int f) netf = fopen(NETDB, "r" ); else rewind(netf); - _net_stayopen |= f; + if (f) _net_stayopen = 1; __UCLIBC_MUTEX_UNLOCK(mylock); return; } diff --git a/libc/inet/getproto.c b/libc/inet/getproto.c index f28a4cb17..5ee003906 100644 --- a/libc/inet/getproto.c +++ b/libc/inet/getproto.c @@ -83,7 +83,7 @@ __UCLIBC_MUTEX_STATIC(mylock, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP); static FILE *protof = NULL; static struct protoent proto; static char *static_aliases = NULL; -static int proto_stayopen; +static smallint proto_stayopen; static void __initbuf(void) { @@ -100,7 +100,7 @@ void setprotoent(int f) protof = fopen(_PATH_PROTOCOLS, "r" ); else rewind(protof); - proto_stayopen |= f; + if (f) proto_stayopen = 1; __UCLIBC_MUTEX_UNLOCK(mylock); } libc_hidden_def(setprotoent) diff --git a/libc/inet/getservice.c b/libc/inet/getservice.c index e2a158cba..98bbc7cc5 100644 --- a/libc/inet/getservice.c +++ b/libc/inet/getservice.c @@ -86,7 +86,7 @@ __UCLIBC_MUTEX_STATIC(mylock, PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP); static FILE *servf = NULL; static struct servent serv; static char *servbuf = NULL; -static int serv_stayopen; +static smallint serv_stayopen; static void __initbuf(void) { @@ -103,7 +103,7 @@ void setservent(int f) servf = fopen(_PATH_SERVICES, "r" ); else rewind(servf); - serv_stayopen |= f; + if (f) serv_stayopen = 1; __UCLIBC_MUTEX_UNLOCK(mylock); } libc_hidden_def(setservent) -- cgit v1.2.3