Bladeren bron

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
Denis Vlasenko 16 jaren geleden
bovenliggende
commit
06607b674f
6 gewijzigde bestanden met toevoegingen van 9 en 9 verwijderingen
  1. 1 1
      libc/inet/gai_strerror.c
  2. 1 1
      libc/inet/getnetbyad.c
  3. 1 1
      libc/inet/getnetbynm.c
  4. 2 2
      libc/inet/getnetent.c
  5. 2 2
      libc/inet/getproto.c
  6. 2 2
      libc/inet/getservice.c

+ 1 - 1
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;

+ 1 - 1
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)
 {

+ 1 - 1
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)

+ 2 - 2
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;
 }

+ 2 - 2
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)

+ 2 - 2
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)