diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-04-28 21:56:46 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-04-28 21:56:46 +0000 |
commit | 390500b147a8063ea4be7313ec38cada26f9235a (patch) | |
tree | edf14c04a0a46992ce4c04eeaf604fab99a9d960 /inet | |
parent | fbb9cc9129ae3efdb1652b175f57956033102876 (diff) | |
download | glibc-390500b147a8063ea4be7313ec38cada26f9235a.zip glibc-390500b147a8063ea4be7313ec38cada26f9235a.tar.gz glibc-390500b147a8063ea4be7313ec38cada26f9235a.tar.bz2 |
Update.
1999-04-28 Ulrich Drepper <drepper@cygnus.com>
* manager.c (pthread_allocate_stack): Optimize initialization of new
thread descriptor.
Diffstat (limited to 'inet')
-rw-r--r-- | inet/ether_hton.c | 4 | ||||
-rw-r--r-- | inet/ether_line.c | 4 | ||||
-rw-r--r-- | inet/ether_ntoh.c | 4 | ||||
-rw-r--r-- | inet/getnameinfo.c | 10 | ||||
-rw-r--r-- | inet/getnetgrent_r.c | 4 | ||||
-rw-r--r-- | inet/ruserpass.c | 50 |
6 files changed, 45 insertions, 31 deletions
diff --git a/inet/ether_hton.c b/inet/ether_hton.c index 4e24fbb..92353c1 100644 --- a/inet/ether_hton.c +++ b/inet/ether_hton.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -44,7 +44,7 @@ extern int __nss_ethers_lookup (service_user **nip, const char *name, int ether_hostton (const char *hostname, struct ether_addr *addr) { - static service_user *startp = NULL; + static service_user *startp; static lookup_function start_fct; service_user *nip; lookup_function fct; diff --git a/inet/ether_line.c b/inet/ether_line.c index 889be0a4..0911499 100644 --- a/inet/ether_line.c +++ b/inet/ether_line.c @@ -62,9 +62,7 @@ ether_line (const char *line, struct ether_addr *addr, char *hostname) } /* Remove trailing white space. */ - cp = strchr (line, '#'); - if (cp == NULL) - cp = strchr (line, '\0'); + cp = __strchrnul (line, '#'); while (cp > line && isspace (cp[-1])) --cp; *cp = '\0'; diff --git a/inet/ether_ntoh.c b/inet/ether_ntoh.c index ab3650f..6937201 100644 --- a/inet/ether_ntoh.c +++ b/inet/ether_ntoh.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -45,7 +45,7 @@ extern int __nss_ethers_lookup (service_user **nip, const char *name, int ether_ntohost (char *hostname, const struct ether_addr *addr) { - static service_user *startp = NULL; + static service_user *startp; static lookup_function start_fct; service_user *nip; lookup_function fct; diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c index f31d3b9..b69bdbe 100644 --- a/inet/getnameinfo.c +++ b/inet/getnameinfo.c @@ -66,15 +66,15 @@ static char * internal_function nrl_domainname (void) { - static char *domain = NULL; - static int first = 1; + static char *domain; + static int not_first; - if (first) + if (not_first) { __libc_lock_define_initialized (static, lock); __libc_lock_lock (lock); - if (first) + if (not_first) { char *c; struct hostent *h, th; @@ -82,7 +82,7 @@ nrl_domainname (void) char *tmpbuf = alloca (tmpbuflen); int herror; - first = 0; + not_first = 1; while (__gethostbyname_r ("localhost", &th, tmpbuf, tmpbuflen, &h, &herror)) diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c index d344379..4bbba38 100644 --- a/inet/getnetgrent_r.c +++ b/inet/getnetgrent_r.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -48,7 +48,7 @@ static enum nss_status setup (void **fctp, const char *func_name, int all) { /* Remember the first service_entry, it's always the same. */ - static service_user *startp = NULL; + static service_user *startp; int no_more; if (startp == NULL) diff --git a/inet/ruserpass.c b/inet/ruserpass.c index d8ea79a..2673fc5 100644 --- a/inet/ruserpass.c +++ b/inet/ruserpass.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#ifndef lint +#if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)ruserpass.c 8.3 (Berkeley) 4/2/94"; #endif /* not lint */ @@ -61,18 +61,35 @@ static FILE *cfile; static char tokval[100]; -static struct toktab { - const char *tokstr; +static const char tokstr[] = +{ +#define TOK_DEFAULT_IDX 0 + "default\0" +#define TOK_LOGIN_IDX (TOK_DEFAULT_IDX + sizeof "default") + "login\0" +#define TOK_PASSWORD_IDX (TOK_LOGIN_IDX + sizeof "login") + "password\0" +#define TOK_PASSWD_IDX (TOK_PASSWORD_IDX + sizeof "password") + "passwd\0" +#define TOK_ACCOUNT_IDX (TOK_PASSWD_IDX + sizeof "passwd") + "account\0" +#define TOK_MACHINE_IDX (TOK_ACCOUNT_IDX + sizeof "account") + "machine\0" +#define TOK_MACDEF_IDX (TOK_MACHINE_IDX + sizeof "machine") + "macdef" +}; + +static const struct toktab { + int tokstr_off; int tval; } toktab[]= { - { "default", DEFAULT }, - { "login", LOGIN }, - { "password", PASSWD }, - { "passwd", PASSWD }, - { "account", ACCOUNT }, - { "machine", MACHINE }, - { "macdef", MACDEF }, - { NULL, 0 } + { TOK_DEFAULT_IDX, DEFAULT }, + { TOK_LOGIN_IDX, LOGIN }, + { TOK_PASSWORD_IDX, PASSWD }, + { TOK_PASSWD_IDX, PASSWD }, + { TOK_ACCOUNT_IDX, ACCOUNT }, + { TOK_MACHINE_IDX, MACHINE }, + { TOK_MACDEF_IDX, MACDEF } }; @@ -106,8 +123,7 @@ ruserpass(host, aname, apass) } if (__gethostname(myname, sizeof(myname)) < 0) myname[0] = '\0'; - if ((mydomain = strchr(myname, '.')) == NULL) - mydomain = ""; + mydomain = __strchrnul(myname, '.'); next: while ((t = token())) switch(t) { @@ -262,7 +278,7 @@ token() { char *cp; int c; - struct toktab *t; + int i; if (feof_unlocked(cfile) || ferror_unlocked(cfile)) return (0); @@ -290,8 +306,8 @@ token() *cp = 0; if (tokval[0] == 0) return (0); - for (t = toktab; t->tokstr; t++) - if (!strcmp(t->tokstr, tokval)) - return (t->tval); + for (i = 0; i < sizeof (toktab) / sizeof (toktab[0]); ++i) + if (!strcmp(&tokstr[toktab[i].tokstr_off], tokval)) + return toktab[i].tval; return (ID); } |