From 970362dc5632a62dd1bf7ecb20dc112ed1528267 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 20 Dec 2005 18:18:28 +0000 Subject: [PATCH] * misc/getusershell.c (initshells): Remove unnecessary tests. (endusershell): Likewise. (okshells): Mark as const. --- ChangeLog | 4 ++++ misc/getusershell.c | 16 +++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 791d3b5134..62f6e8ab9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-12-20 Ulrich Drepper + * misc/getusershell.c (initshells): Remove unnecessary tests. + (endusershell): Likewise. + (okshells): Mark as const. + * sysdeps/posix/gai_strerror.c: Complete rewrite. Avoid relocations. * sysdeps/posix/gai_strerror-strs.h: New file. * sysdeps/posix/Dist: New file. diff --git a/misc/getusershell.c b/misc/getusershell.c index 95f0eab5e2..f41c6fa5f0 100644 --- a/misc/getusershell.c +++ b/misc/getusershell.c @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)getusershell.c 8.1 (Berkeley) 6/4/93"; * /etc/shells. */ -static const char *okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL }; +static const char *const okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL }; static char **curshell, **shells, *strings; static char **initshells (void) __THROW; @@ -70,11 +70,9 @@ void endusershell() { - if (shells != NULL) - free(shells); + free(shells); shells = NULL; - if (strings != NULL) - free(strings); + free(strings); strings = NULL; curshell = NULL; } @@ -94,11 +92,9 @@ initshells() struct stat64 statb; int flen; - if (shells != NULL) - free(shells); + free(shells); shells = NULL; - if (strings != NULL) - free(strings); + free(strings); strings = NULL; if ((fp = fopen(_PATH_SHELLS, "rc")) == NULL) return (char **) okshells; @@ -117,8 +113,6 @@ initshells() strings = NULL; return (char **) okshells; } - /* No threads using this stream. */ - __fsetlocking (fp, FSETLOCKING_BYCALLER); sp = shells; cp = strings; flen = statb.st_size;