Reduce .data size.

This commit is contained in:
Ulrich Drepper 2001-01-21 19:30:28 +00:00
parent 01ed37472a
commit 3e2d61a360
1 changed files with 18 additions and 14 deletions

View File

@ -79,7 +79,7 @@ struct gaih_servtuple
int port; int port;
}; };
static struct gaih_servtuple nullserv = { NULL, 0, 0, 0 }; static const struct gaih_servtuple nullserv;
struct gaih_addrtuple struct gaih_addrtuple
{ {
@ -93,7 +93,7 @@ struct gaih_typeproto
{ {
int socktype; int socktype;
int protocol; int protocol;
char *name; char name[4];
int protoflag; int protoflag;
}; };
@ -101,13 +101,13 @@ struct gaih_typeproto
#define GAI_PROTO_NOSERVICE 1 #define GAI_PROTO_NOSERVICE 1
#define GAI_PROTO_PROTOANY 2 #define GAI_PROTO_PROTOANY 2
static struct gaih_typeproto gaih_inet_typeproto[] = static const struct gaih_typeproto gaih_inet_typeproto[] =
{ {
{ 0, 0, NULL, 0 }, { 0, 0, "", 0 },
{ SOCK_STREAM, IPPROTO_TCP, (char *) "tcp", 0 }, { SOCK_STREAM, IPPROTO_TCP, "tcp", 0 },
{ SOCK_DGRAM, IPPROTO_UDP, (char *) "udp", 0 }, { SOCK_DGRAM, IPPROTO_UDP, "udp", 0 },
{ SOCK_RAW, 0, (char *) "raw", GAI_PROTO_PROTOANY|GAI_PROTO_NOSERVICE }, { SOCK_RAW, 0, "raw", GAI_PROTO_PROTOANY|GAI_PROTO_NOSERVICE },
{ 0, 0, NULL, 0 } { 0, 0, "", 0 }
}; };
struct gaih struct gaih
@ -117,8 +117,12 @@ struct gaih
const struct addrinfo *req, struct addrinfo **pai); const struct addrinfo *req, struct addrinfo **pai);
}; };
static struct addrinfo default_hints = #if PF_UNSPEC == 0
static const struct addrinfo default_hints;
#else
static const struct addrinfo default_hints =
{ 0, PF_UNSPEC, 0, 0, 0, NULL, NULL, NULL }; { 0, PF_UNSPEC, 0, 0, 0, NULL, NULL, NULL };
#endif
static int static int
@ -145,7 +149,7 @@ gaih_local (const char *name, const struct gaih_service *service,
if (req->ai_protocol || req->ai_socktype) if (req->ai_protocol || req->ai_socktype)
{ {
struct gaih_typeproto *tp = gaih_inet_typeproto + 1; const struct gaih_typeproto *tp = gaih_inet_typeproto + 1;
while (tp->name != NULL while (tp->name != NULL
&& ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0 && ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0
@ -230,7 +234,7 @@ gaih_local (const char *name, const struct gaih_service *service,
} }
static int static int
gaih_inet_serv (const char *servicename, struct gaih_typeproto *tp, gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
const struct addrinfo *req, struct gaih_servtuple *st) const struct addrinfo *req, struct gaih_servtuple *st)
{ {
struct servent *s; struct servent *s;
@ -311,8 +315,8 @@ static int
gaih_inet (const char *name, const struct gaih_service *service, gaih_inet (const char *name, const struct gaih_service *service,
const struct addrinfo *req, struct addrinfo **pai) const struct addrinfo *req, struct addrinfo **pai)
{ {
struct gaih_typeproto *tp = gaih_inet_typeproto; const struct gaih_typeproto *tp = gaih_inet_typeproto;
struct gaih_servtuple *st = &nullserv; struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv;
struct gaih_addrtuple *at = NULL; struct gaih_addrtuple *at = NULL;
int rc; int rc;
@ -382,7 +386,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
*pst = newp; *pst = newp;
pst = &(newp->next); pst = &(newp->next);
} }
if (st == &nullserv) if (st == (struct gaih_servtuple *) &nullserv)
return (GAIH_OKIFUNSPEC | -EAI_SERVICE); return (GAIH_OKIFUNSPEC | -EAI_SERVICE);
} }
} }