aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-04-28 21:56:46 +0000
committerUlrich Drepper <drepper@redhat.com>1999-04-28 21:56:46 +0000
commit390500b147a8063ea4be7313ec38cada26f9235a (patch)
treeedf14c04a0a46992ce4c04eeaf604fab99a9d960
parentfbb9cc9129ae3efdb1652b175f57956033102876 (diff)
downloadglibc-390500b147a8063ea4be7313ec38cada26f9235a.tar.xz
glibc-390500b147a8063ea4be7313ec38cada26f9235a.zip
Update.
1999-04-28 Ulrich Drepper <drepper@cygnus.com> * manager.c (pthread_allocate_stack): Optimize initialization of new thread descriptor.
-rw-r--r--argp/argp-ba.c4
-rw-r--r--argp/argp-help.c8
-rw-r--r--argp/argp-parse.c4
-rw-r--r--argp/argp-pv.c4
-rw-r--r--argp/argp-pvh.c4
-rw-r--r--catgets/catgets.c95
-rw-r--r--catgets/open_catalog.c27
-rw-r--r--ctype/ctype-extn.c23
-rw-r--r--grp/initgroups.c13
-rw-r--r--iconv/gconv.h2
-rw-r--r--iconv/gconv_close.c3
-rw-r--r--iconv/gconv_conf.c11
-rw-r--r--iconv/gconv_db.c9
-rw-r--r--iconv/gconv_open.c72
-rw-r--r--include/string.h2
-rw-r--r--include/time.h4
-rw-r--r--inet/ether_hton.c4
-rw-r--r--inet/ether_line.c4
-rw-r--r--inet/ether_ntoh.c4
-rw-r--r--inet/getnameinfo.c10
-rw-r--r--inet/getnetgrent_r.c4
-rw-r--r--inet/ruserpass.c50
-rw-r--r--intl/finddomain.c5
-rw-r--r--intl/loadmsgcat.c4
-rw-r--r--intl/localealias.c12
-rw-r--r--io/ftw.c6
-rw-r--r--libio/iopopen.c4
-rw-r--r--libio/oldiopopen.c4
-rw-r--r--linuxthreads/ChangeLog5
-rw-r--r--linuxthreads/manager.c27
30 files changed, 197 insertions, 231 deletions
diff --git a/argp/argp-ba.c b/argp/argp-ba.c
index 5d58cc6c51..5657c2748e 100644
--- a/argp/argp-ba.c
+++ b/argp/argp-ba.c
@@ -1,5 +1,5 @@
/* Default definition for ARGP_PROGRAM_BUG_ADDRESS.
- 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.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@@ -23,4 +23,4 @@
the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help
messages), embedded in a sentence that says something like `Report bugs to
ADDR.'. */
-const char *argp_program_bug_address = 0;
+const char *argp_program_bug_address;
diff --git a/argp/argp-help.c b/argp/argp-help.c
index d78060d12c..f5d96fb1ef 100644
--- a/argp/argp-help.c
+++ b/argp/argp-help.c
@@ -1376,19 +1376,17 @@ argp_args_usage (const struct argp *argp, const struct argp_state *state,
if (fdoc)
{
const char *cp = fdoc;
- nl = strchr (cp, '\n');
- if (nl)
+ nl = __strchrnul (cp, '\n');
+ if (*nl != '\0')
/* This is a `multi-level' args doc; advance to the correct position
as determined by our state in LEVELS, and update LEVELS. */
{
int i;
multiple = 1;
for (i = 0; i < *our_level; i++)
- cp = nl + 1, nl = strchr (cp, '\n');
+ cp = nl + 1, nl = __strchrnul (cp, '\n');
(*levels)++;
}
- if (! nl)
- nl = cp + strlen (cp);
/* Manually do line wrapping so that it (probably) won't get wrapped at
any embedded spaces. */
diff --git a/argp/argp-parse.c b/argp/argp-parse.c
index e59f614a05..758129aab1 100644
--- a/argp/argp-parse.c
+++ b/argp/argp-parse.c
@@ -1,5 +1,5 @@
/* Hierarchial argument parsing, layered over getopt
- Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@@ -76,7 +76,7 @@
for one second intervals, decrementing _ARGP_HANG until it's zero. Thus
you can force the program to continue by attaching a debugger and setting
it to 0 yourself. */
-volatile int _argp_hang = 0;
+volatile int _argp_hang;
#define OPT_PROGNAME -2
#define OPT_USAGE -3
diff --git a/argp/argp-pv.c b/argp/argp-pv.c
index 27d714b361..506107436b 100644
--- a/argp/argp-pv.c
+++ b/argp/argp-pv.c
@@ -1,5 +1,5 @@
/* Default definition for ARGP_PROGRAM_VERSION.
- 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.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@@ -22,4 +22,4 @@
--version is added (unless the ARGP_NO_HELP flag is used), which will
print this this string followed by a newline and exit (unless the
ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */
-const char *argp_program_version = 0;
+const char *argp_program_version;
diff --git a/argp/argp-pvh.c b/argp/argp-pvh.c
index ed60aa992d..2d0bd39576 100644
--- a/argp/argp-pvh.c
+++ b/argp/argp-pvh.c
@@ -1,5 +1,5 @@
/* Default definition for ARGP_PROGRAM_VERSION_HOOK.
- 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.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@@ -29,4 +29,4 @@
this function with a stream to print the version to and a pointer to the
current parsing state, and then exits (unless the ARGP_NO_EXIT flag is
used). This variable takes precedent over ARGP_PROGRAM_VERSION. */
-void (*argp_program_version_hook) (FILE *stream, struct argp_state *state) = 0;
+void (*argp_program_version_hook) (FILE *stream, struct argp_state *state);
diff --git a/catgets/catgets.c b/catgets/catgets.c
index 55de30ee46..c6fd13d4b4 100644
--- a/catgets/catgets.c
+++ b/catgets/catgets.c
@@ -33,23 +33,12 @@ nl_catd
catopen (const char *cat_name, int flag)
{
__nl_catd result;
- const char *env_var;
- const char *nlspath;
-
- result = (__nl_catd) malloc (sizeof (*result));
- if (result == NULL)
- /* We cannot get enough memory. */
- return (nl_catd) -1;
-
- result->status = closed;
-
- result->cat_name = __strdup (cat_name);
- if (result->cat_name == NULL)
- {
- free (result);
- __set_errno (ENOMEM);
- return (nl_catd) -1;
- }
+ const char *env_var = NULL;
+ const char *nlspath = NULL;
+ size_t cat_name_len = strlen (cat_name) + 1;
+ size_t env_var_len = 0;
+ size_t nlspath_len = 0;
+ char *endp;
if (strchr (cat_name, '/') == NULL)
{
@@ -57,32 +46,19 @@ catopen (const char *cat_name, int flag)
{
env_var = getenv ("LC_ALL");
if (env_var == NULL)
- {
- env_var = getenv ("LC_MESSAGES");
- if (env_var == NULL)
- {
- env_var = getenv ("LANG");
- if (env_var == NULL)
- env_var = "C";
- }
- }
- }
- else
- {
- env_var = getenv ("LANG");
- if (env_var == NULL)
- env_var = "C";
- }
+ env_var = getenv ("LC_MESSAGES");
- result->env_var = __strdup (env_var);
- if (result->env_var == NULL)
- {
- free ((void *) result->cat_name);
- free ((void *) result);
- __set_errno (ENOMEM);
- return (nl_catd) -1;
+ if (env_var != NULL)
+ goto have_env_var;
}
+ env_var = getenv ("LANG");
+ if (env_var == NULL)
+ env_var = "C";
+
+ have_env_var:
+ env_var_len = strlen (env_var) + 1;
+
nlspath = __secure_getenv ("NLSPATH");
if (nlspath != NULL && *nlspath != '\0')
{
@@ -92,25 +68,32 @@ catopen (const char *cat_name, int flag)
__stpcpy (__stpcpy (__stpcpy (tmp, nlspath), ":"), NLSPATH);
nlspath = tmp;
+
+ nlspath_len = len;
}
else
- nlspath = NLSPATH;
-
- result->nlspath = __strdup (nlspath);
- if (result->nlspath == NULL)
{
- free ((void *) result->cat_name);
- free ((void *) result->env_var);
- free ((void *) result);
- __set_errno (ENOMEM);
- return (nl_catd) -1;
+ nlspath = NLSPATH;
+
+ nlspath_len = sizeof NLSPATH;
}
}
- else
- {
- result->env_var = NULL;
- result->nlspath = NULL;
- }
+
+ result = (__nl_catd) malloc (sizeof (*result) + cat_name_len
+ + env_var_len + nlspath_len);
+ if (result == NULL)
+ /* We cannot get enough memory. */
+ return (nl_catd) -1;
+
+ result->status = closed;
+ result->cat_name = endp = (char *) (result + 1);
+ endp = __mempcpy (endp, cat_name, cat_name_len);
+
+ result->env_var = cat_name_len != 0 ? endp : NULL;
+ endp = __mempcpy (endp, env_var, env_var_len);
+
+ result->nlspath = nlspath_len != 0 ? endp : NULL;
+ memcpy (endp, nlspath, nlspath_len);
__libc_lock_init (result->lock);
@@ -179,10 +162,6 @@ catclose (nl_catd catalog_desc)
return -1;
}
- if (catalog->nlspath)
- free ((void *) catalog->nlspath);
- if (catalog->env_var)
- free ((void *) catalog->env_var);
free ((void *) catalog);
return 0;
diff --git a/catgets/open_catalog.c b/catgets/open_catalog.c
index e4b61d779a..4b619e49e9 100644
--- a/catgets/open_catalog.c
+++ b/catgets/open_catalog.c
@@ -1,6 +1,6 @@
-/* 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.
- Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
+ Contributed by Ulrich Drepper, <drepper@gnu.org>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@@ -182,10 +182,13 @@ __open_catalog (__nl_catd catalog)
}
/* Avoid dealing with directories and block devices */
- if (fd < 0 || __fstat (fd, &st) < 0)
+ if (fd < 0)
+ goto unlock_return;
+
+ if (__fxstat (_STAT_VER, fd, &st) < 0)
{
catalog->status = nonexisting;
- goto unlock_return;
+ goto close_unlock_return;
}
if (!S_ISREG (st.st_mode) || st.st_size < sizeof (struct catalog_obj))
{
@@ -193,7 +196,7 @@ __open_catalog (__nl_catd catalog)
Use an reasonable error value. */
__set_errno (EINVAL);
catalog->status = nonexisting;
- goto unlock_return;
+ goto close_unlock_return;
}
catalog->file_size = st.st_size;
@@ -226,7 +229,7 @@ __open_catalog (__nl_catd catalog)
if (catalog->file_ptr == NULL)
{
catalog->status = nonexisting;
- goto unlock_return;
+ goto close_unlock_return;
}
todo = st.st_size;
/* Save read, handle partial reads. */
@@ -238,7 +241,7 @@ __open_catalog (__nl_catd catalog)
{
free ((void *) catalog->file_ptr);
catalog->status = nonexisting;
- goto unlock_return;
+ goto close_unlock_return;
}
todo -= now;
}
@@ -246,10 +249,6 @@ __open_catalog (__nl_catd catalog)
catalog->status = malloced;
}
- /* We don't need the file anymore. */
- __close (fd);
- fd = -1;
-
/* Determine whether the file is a catalog file and if yes whether
it is written using the correct byte order. Else we have to swap
the values. */
@@ -269,7 +268,7 @@ __open_catalog (__nl_catd catalog)
#endif /* _POSIX_MAPPED_FILES */
free (catalog->file_ptr);
catalog->status = nonexisting;
- goto unlock_return;
+ goto close_unlock_return;
}
#define SWAP(x) (swapping ? SWAPU32 (x) : (x))
@@ -320,8 +319,8 @@ __open_catalog (__nl_catd catalog)
}
/* Release the lock again. */
+ close_unlock_return:
+ __close (fd);
unlock_return:
- if (fd != -1)
- __close (fd);
__libc_lock_unlock (catalog->lock);
}
diff --git a/ctype/ctype-extn.c b/ctype/ctype-extn.c
index 5daba66804..cfc8b87d41 100644
--- a/ctype/ctype-extn.c
+++ b/ctype/ctype-extn.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1997, 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
@@ -22,20 +22,21 @@
/* Real function versions of the non-ANSI ctype functions. */
int
-isblank (int c)
+__isblank (int c)
{
return __isctype (c, _ISblank);
}
+weak_alias (__isblank, isblank)
int
_tolower (int c)
{
- return c < -128 || c > 255 ? c : __ctype_tolower[c];
+ return __ctype_tolower[c];
}
int
_toupper (int c)
{
- return c < -128 || c > 255 ? c : __ctype_toupper[c];
+ return __ctype_toupper[c];
}
int
@@ -43,11 +44,14 @@ toascii (int c)
{
return __toascii (c);
}
+weak_alias (toascii, __toascii_l)
+
int
isascii (int c)
{
return __isascii (c);
}
+weak_alias (isascii, __isascii_l)
int
@@ -55,14 +59,3 @@ __isblank_l (int c, __locale_t l)
{
return __isctype_l (c, _ISblank, l);
}
-
-int
-__toascii_l (int c, __locale_t l)
-{
- return __toascii (c);
-}
-int
-__isascii_l (int c, __locale_t l)
-{
- return __isascii (c);
-}
diff --git a/grp/initgroups.c b/grp/initgroups.c
index 93f78eb547..0296625122 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -52,7 +52,7 @@ static enum nss_status
compat_call (service_user *nip, const char *user, gid_t group, long int *start,
long int *size, gid_t *groups, long int limit, int *errnop)
{
- struct group grpbuf, *g;
+ struct group grpbuf;
size_t buflen = __sysconf (_SC_GETPW_R_SIZE_MAX);
char *tmpbuf;
enum nss_status status;
@@ -90,25 +90,24 @@ compat_call (service_user *nip, const char *user, gid_t group, long int *start,
if (status != NSS_STATUS_SUCCESS)
goto done;
- g = &grpbuf;
- if (g->gr_gid != group)
+ if (grpbuf.gr_gid != group)
{
char **m;
- for (m = g->gr_mem; *m != NULL; ++m)
+ for (m = grpbuf.gr_mem; *m != NULL; ++m)
if (strcmp (*m, user) == 0)
{
/* Matches user. Insert this group. */
if (*start == *size && limit <= 0)
{
/* Need a bigger buffer. */
- groups = realloc (groups, *size * sizeof (*groups));
+ groups = realloc (groups, 2 * *size * sizeof (*groups));
if (groups == NULL)
goto done;
*size *= 2;
}
- groups[*start] = g->gr_gid;
+ groups[*start] = grpbuf.gr_gid;
*start += 1;
if (*start == limit)
@@ -196,7 +195,7 @@ initgroups (user, group)
/* This is really only for debugging. */
if (NSS_STATUS_TRYAGAIN > status || status > NSS_STATUS_RETURN)
- __libc_fatal ("illegal status in " __FUNCTION__);
+ __libc_fatal ("illegal status in " __FUNCTION__);
if (status != NSS_STATUS_SUCCESS
&& nss_next_action (nip, status) == NSS_ACTION_RETURN)
diff --git a/iconv/gconv.h b/iconv/gconv.h
index 6576b0621f..4b71ccf4b8 100644
--- a/iconv/gconv.h
+++ b/iconv/gconv.h
@@ -123,7 +123,7 @@ typedef struct gconv_info
{
size_t nsteps;
struct gconv_step *steps;
- struct gconv_step_data *data;
+ struct gconv_step_data data[0];
} *gconv_t;
#endif /* gconv.h */
diff --git a/iconv/gconv_close.c b/iconv/gconv_close.c
index de0937d610..2fe842467b 100644
--- a/iconv/gconv_close.c
+++ b/iconv/gconv_close.c
@@ -1,5 +1,5 @@
/* Release any resource associated with given conversion descriptor.
- Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -44,7 +44,6 @@ __gconv_close (gconv_t cd)
while (!(drunp++)->is_last);
/* Free the data allocated for the descriptor. */
- free (cd->data);
free (cd);
/* Close the participating modules. */
diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
index a0aae43138..dce913da74 100644
--- a/iconv/gconv_conf.c
+++ b/