/* 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>.
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;
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. */
/* 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>.
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
/* 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>.
--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;
/* 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>.
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);
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)
{
{
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')
{
__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);
return -1;
}
- if (catalog->nlspath)
- free ((void *) catalog->nlspath);
- if (catalog->env_var)
- free ((void *) catalog->env_var);
free ((void *) catalog);
return 0;
-/* 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
}
/* 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))
{
Use an reasonable error value. */
__set_errno (EINVAL);
catalog->status = nonexisting;
- goto unlock_return;
+ goto close_unlock_return;
}
catalog->file_size = st.st_size;
if (catalog->file_ptr == NULL)
{
catalog->status = nonexisting;
- goto unlock_return;
+ goto close_unlock_return;
}
todo = st.st_size;
/* Save read, handle partial reads. */
{
free ((void *) catalog->file_ptr);
catalog->status = nonexisting;
- goto unlock_return;
+ goto close_unlock_return;
}
todo -= now;
}
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. */
#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))
}
/* Release the lock again. */
+ close_unlock_return:
+ __close (fd);
unlock_return:
- if (fd != -1)
- __close (fd);
__libc_lock_unlock (catalog->lock);
}
-/* 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
/* 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
{
return __toascii (c);
}
+weak_alias (toascii, __toascii_l)
+
int
isascii (int c)
{
return __isascii (c);
}
+weak_alias (isascii, __isascii_l)
int
{
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);
-}
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;
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)
/* 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)
{
size_t nsteps;
struct gconv_step *steps;
- struct gconv_step_data *data;
+ struct gconv_step_data data[0];
} *gconv_t;
#endif /* gconv.h */
/* 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.
while (!(drunp++)->is_last);
/* Free the data allocated for the descriptor. */
- free (cd->data);
free (cd);
/* Close the participating modules. */
#undef BUILTIN_TRANSFORMATION
#undef BUILTIN_ALIAS
-static const char *
-builtin_aliases[] =
+static const char *builtin_aliases[] =
{
#define BUILTIN_TRANSFORMATION(From, ConstPfx, ConstLen, To, Cost, Name, \
Fct, Init, End, MinF, MaxF, MinT, MaxT)
malloc (sizeof (struct gconv_alias) + (wp - from));
if (new_alias != NULL)
{
+ void **inserted;
+
new_alias->fromname = memcpy ((char *) new_alias
+ sizeof (struct gconv_alias),
from, wp - from);
new_alias->toname = new_alias->fromname + (to - from);
- if (__tfind (new_alias, &__gconv_alias_db, __gconv_alias_compare) != NULL
- || (__tsearch (new_alias, &__gconv_alias_db, __gconv_alias_compare)
- == NULL))
+ inserted = (void **) __tsearch (new_alias, &__gconv_alias_db,
+ __gconv_alias_compare);
+ if (inserted == NULL || *inserted != (void **) new_alias)
/* Something went wrong, free this entry. */
free (new_alias);
}
malloc (sizeof (struct known_derivation) + fromset_len + toset_len);
if (new_deriv != NULL)
{
- new_deriv->from = memcpy (new_deriv + 1, fromset, fromset_len);
- new_deriv->to = memcpy ((char *) new_deriv->from + fromset_len,
+ new_deriv->from = (char *) (new_deriv + 1);
+ new_deriv->to = memcpy (__mempcpy (new_deriv + 1, fromset, fromset_len),
toset, toset_len);
new_deriv->steps = handle;
new_deriv->nsteps = nsteps;
- __tsearch (new_deriv, &known_derivations, derivation_compare);
+ if (__tsearch (new_deriv, &known_derivations, derivation_compare)
+ == NULL)
+ /* There is some kind of memory allocation problem. */
+ free (new_deriv);
}
/* Please note that we don't complain if the allocation failed. This
is not tragically but in case we use the memory debugging facilities
/* Find matching transformation algorithms and initialize steps.
- 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.
if (res == GCONV_OK)
{
/* Allocate room for handle. */
- result = (gconv_t) malloc (sizeof (struct gconv_info));
+ result = (gconv_t) malloc (sizeof (struct gconv_info)
+ + nsteps * sizeof (struct gconv_step_data));
if (result == NULL)
res = GCONV_NOMEM;
else
result->steps = steps;
result->nsteps = nsteps;
- /* Allocate array for the step data. */
- result->data = (struct gconv_step_data *)
- calloc (nsteps, sizeof (struct gconv_step_data));
+ /* Clear the array for the step data. */
+ memset (result->data, '\0',
+ nsteps * sizeof (struct gconv_step_data));
- if (result->data == NULL)
- res = GCONV_NOMEM;
- else
+ /* Call all initialization functions for the transformation
+ step implemenations. */
+ for (cnt = 0; cnt < nsteps; ++cnt)
{
- /* Call all initialization functions for the transformation
- step implemenations. */
- struct gconv_step_data *data = result->data;
+ /* If this is the last step we must not allocate an
+ output buffer. */
+ result->data[cnt].is_last = cnt == nsteps - 1;
- for (cnt = 0; cnt < nsteps; ++cnt)
- {
- /* If this is the last step we must not allocate an output
- buffer. */
- data[cnt].is_last = cnt == nsteps - 1;
+ /* Reset the counter. */
+ result->data[cnt].invocation_counter = 0;
- /* Reset the counter. */
- data[cnt].invocation_counter = 0;
+ /* It's a regular use. */
+ result->data[cnt].internal_use = 0;
- /* It's a regular use. */
- data[cnt].internal_use = 0;
+ /* We use the `mbstate_t' member in DATA. */
+ result->data[cnt].statep = &result->data[cnt].__state;
- /* We use the `mbstate_t' member in DATA. */
- data[cnt].statep = &data[cnt].__state;
+ /* Allocate the buffer. */
+ if (!result->data[cnt].is_last)
+ {
+ size_t size = (GCONV_NCHAR_GOAL
+ * steps[cnt].max_needed_to);
- /* Allocate the buffer. */
- if (!data[cnt].is_last)
+ result->data[cnt].outbuf = (char *) malloc (size);
+ if (result->data[cnt].outbuf == NULL)
{
- size_t size = (GCONV_NCHAR_GOAL
- * steps[cnt].max_needed_to);
-
- data[cnt].outbuf = (char *) malloc (size);
- if (data[cnt].outbuf == NULL)
- {
- res = GCONV_NOMEM;
- break;
- }
- data[cnt].outbufend = data[cnt].outbuf + size;
+ res = GCONV_NOMEM;
+ break;
}
+ result->data[cnt].outbufend = (result->data[cnt].outbuf
+ + size);
}
}
}
if (result != NULL)
{
- if (result->data != NULL)
- {
- while (cnt-- > 0)
- free (result->data[cnt].outbuf);
-
- free (result->data);
- }
+ while (cnt-- > 0)
+ free (result->data[cnt].outbuf);
free (result);
result = NULL;
extern __ptr_t __rawmemchr __P ((__const __ptr_t __s, int __c));
+extern char *__strchrnul __P ((__const char *__s, int __c));
+
#endif
extern int __use_tzfile;
-extern void __tzfile_read __P ((const char *file));extern int __tzfile_compute __P ((time_t timer, int use_localtime,
+extern void __tzfile_read __P ((const char *file, size_t extra,
+ char **extrap));
+extern int __tzfile_compute __P ((time_t timer, int use_localtime,
long int *leap_correct, int *leap_hit,
struct tm *tp));
extern void __tzfile_default __P ((const char *std, const char *dst,
-/* 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.
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;
}
/* 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';
-/* 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.
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;
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;
char *tmpbuf = alloca (tmpbuflen);
int herror;
- first = 0;
+ not_first = 1;
while (__gethostbyname_r ("localhost", &th, tmpbuf, tmpbuflen, &h,
&herror))
-/* 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
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)
* SUCH DAMAGE.
*/
-#ifndef lint
+#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)ruserpass.c 8.3 (Berkeley) 4/2/94";
#endif /* not lint */
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 }
};
}
if (__gethostname(myname, sizeof(myname)) < 0)
myname[0] = '\0';
- if ((mydomain = strchr(myname, '.')) == NULL)
- mydomain = "";
+ mydomain = __strchrnul(myname, '.');
next:
while ((t = token())) switch(t) {
{
char *cp;
int c;
- struct toktab *t;
+ int i;
if (feof_unlocked(cfile) || ferror_unlocked(cfile))
return (0);
*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);
}
# define memcpy(Dst, Src, Num) bcopy (Src, Dst, Num)
# endif
#endif
-#if !HAVE_STRCHR && !defined _LIBC
-# ifndef strchr
-# define strchr index
-# endif
-#endif
#if defined HAVE_UNISTD_H || defined _LIBC
# include <unistd.h>
/* Load needed message catalogs.
- 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. Its master source is NOT part of
the C library, however.
/* We need a sign, whether a new catalog was loaded, which can be associated
with all translations. This is important if the translations are
cached by one of GCC's features. */
-int _nl_msg_cat_cntr = 0;
+int _nl_msg_cat_cntr;
/* Load the message catalogs specified by FILENAME. If it is no valid
/* Handle aliases for locale names.
- 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. Its master source is NOT part of
the C library, however.
};
-static char *string_space = NULL;
-static size_t string_space_act = 0;
-static size_t string_space_max = 0;
+static char *string_space;
+static size_t string_space_act;
+static size_t string_space_max;
static struct alias_map *map;
-static size_t nmap = 0;
-static size_t maxmap = 0;
+static size_t nmap;
+static size_t maxmap;
/* Prototypes for local functions. */
/* Conversion array for flag values. It is the identity mapping for
`nftw' calls, otherwise it maps the values to those know by
`ftw'. */
- int *cvt_arr;
+ const int *cvt_arr;
/* Callback function. We always use the `nftw' form. */
NFTW_FUNC_T func;
/* Internally we use the FTW_* constants used for `nftw'. When the
process called `ftw' we must reduce the flag to the known flags
for `ftw'. */
-static int nftw_arr[] =
+static const int nftw_arr[] =
{
FTW_F, FTW_D, FTW_DNR, FTW_NS, FTW_SL, FTW_DP, FTW_SLN
};
-static int ftw_arr[] =
+static const int ftw_arr[] =
{
FTW_F, FTW_D, FTW_DNR, FTW_NS, FTW_F, FTW_D, FTW_NS
};
-/* Copyright (C) 1993, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
Written by Per Bothner <bothner@cygnus.com>.
};
typedef struct _IO_proc_file _IO_proc_file;
-static struct _IO_proc_file *proc_file_chain = NULL;
+static struct _IO_proc_file *proc_file_chain;
_IO_FILE *
_IO_new_proc_open (fp, command, mode)
-/* Copyright (C) 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
Written by Per Bothner <bothner@cygnus.com>.
};
typedef struct _IO_proc_file _IO_proc_file;
-static struct _IO_proc_file *old_proc_file_chain = NULL;
+static struct _IO_proc_file *old_proc_file_chain;
_IO_FILE *
_IO_old_proc_open (fp, command, mode)
+1999-04-28 Ulrich Drepper <drepper@cygnus.com>
+
+ * manager.c (pthread_allocate_stack): Optimize initialization of new
+ thread descriptor.
+
1999-04-16 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* sysdeps/arm/Implies: Removed since cmpxchg/no-cmpxchg
}
}
}
+ /* Clear the thread data structure. */
+ memset (new_thread, '\0', sizeof (*new_thread));
*out_new_thread = new_thread;
*out_new_thread_bottom = new_thread_bottom;
*out_guardaddr = guardaddr;
/* Allocate new thread identifier */
pthread_threads_counter += PTHREAD_THREADS_MAX;
new_thread_id = sseg + pthread_threads_counter;
- /* Initialize the thread descriptor */
- new_thread->p_nextwaiting = NULL;
+ /* Initialize the thread descriptor. Elements which have to be
+ initialized to zero already have this value. */
new_thread->p_tid = new_thread_id;
- new_thread->p_priority = 0;
new_thread->p_lock = &(__pthread_handles[sseg].h_lock);
- new_thread->p_signal = 0;
- new_thread->p_signal_jmp = NULL;
- new_thread->p_cancel_jmp = NULL;
- new_thread->p_terminated = 0;
- new_thread->p_detached = attr == NULL ? 0 : attr->__detachstate;
- new_thread->p_exited = 0;
- new_thread->p_retval = NULL;
- new_thread->p_joining = NULL;
- new_thread->p_cleanup = NULL;
new_thread->p_cancelstate = PTHREAD_CANCEL_ENABLE;
new_thread->p_canceltype = PTHREAD_CANCEL_DEFERRED;
- new_thread->p_canceled = 0;
new_thread->p_errnop = &new_thread->p_errno;
- new_thread->p_errno = 0;
new_thread->p_h_errnop = &new_thread->p_h_errno;
- new_thread->p_h_errno = 0;
- new_thread->p_in_sighandler = NULL;
- new_thread->p_sigwaiting = 0;
new_thread->p_guardaddr = guardaddr;
new_thread->p_guardsize = guardsize;
- new_thread->p_userstack = attr != NULL && attr->__stackaddr_set;
- memset (new_thread->p_specific, '\0',
- PTHREAD_KEY_1STLEVEL_SIZE * sizeof (new_thread->p_specific[0]));
new_thread->p_self = new_thread;
new_thread->p_nr = sseg;
/* Initialize the thread handle */
/* Determine scheduling parameters for the thread */
new_thread->p_start_args.schedpolicy = -1;
if (attr != NULL) {
+ new_thread->p_detached = attr->__detachstate;
+ new_thread->p_userstack = attr->__stackaddr_set;
+
switch(attr->__inheritsched) {
case PTHREAD_EXPLICIT_SCHED:
new_thread->p_start_args.schedpolicy = attr->__schedpolicy;