diff options
author | Roland McGrath <roland@gnu.org> | 2004-03-25 03:54:03 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2004-03-25 03:54:03 +0000 |
commit | db2f05ba83cd9eaae24b30166816e5169bbae2c0 (patch) | |
tree | 0e742754c54aafc31d38af146808d06300a65286 /locale | |
parent | 61044c288ab5c7c4687205b0bf136e5358bfe1d1 (diff) | |
download | glibc-db2f05ba83cd9eaae24b30166816e5169bbae2c0.tar.gz |
* Makerules ($(common-objpfx)shlib.lds): Don't use \n in rhs of sed
substitutions; the semicolon terminators are enough for ld anyway.
* elf/dl-deps.c (_dl_map_object_deps): Use alloca instead of
dynamically sized auto array in function already using alloca.
* locale/programs/ld-ctype.c (ctype_output): Likewise.
* locale/programs/ld-time.c (time_output): Likewise.
* elf/dl-misc.c (_dl_debug_vdprintf): Use macro instead of const for
IOV array size.
* locale/programs/charmap.c (charmap_read): Avoid alloca (or strdupa)
when also using dynamically-sized auto array.
* locale/programs/locfile.c (locfile_read): Likewise.
* locale/programs/repertoire.c (repertoire_read): Likewise.
* nis/nis_print_group_entry.c (nis_print_group_entry): Likewise.
* locale/programs/locarchive.c (enlarge_archive): Likewise.
* posix/annexc.c (check_header): Likewise.
* iconv/gconv_int.h (norm_add_slashes): Don't handle null SUFFIX.
strlen ("") gets optimized away just as well.
* intl/loadmsgcat.c (_nl_init_domain_conv): Update caller.
* wcsmbs/wcsmbsload.c (__wcsmbs_load_conv): Likewise.
Diffstat (limited to 'locale')
-rw-r--r-- | locale/programs/charmap.c | 8 | ||||
-rw-r--r-- | locale/programs/ld-ctype.c | 9 | ||||
-rw-r--r-- | locale/programs/ld-time.c | 11 | ||||
-rw-r--r-- | locale/programs/locarchive.c | 5 | ||||
-rw-r--r-- | locale/programs/locfile.c | 11 | ||||
-rw-r--r-- | locale/programs/repertoire.c | 9 |
6 files changed, 28 insertions, 25 deletions
diff --git a/locale/programs/charmap.c b/locale/programs/charmap.c index 8c9e4e9abb..8dbac6f5b9 100644 --- a/locale/programs/charmap.c +++ b/locale/programs/charmap.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1998-2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1998-2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.org>, 1996. @@ -106,9 +106,11 @@ charmap_read (const char *filename, int verbose, int be_quiet, int use_default) char *i18npath = getenv ("I18NPATH"); if (i18npath != NULL && *i18npath != '\0') { - char path[strlen (i18npath) + sizeof ("/charmaps")]; + const size_t pathlen = strlen (i18npath); + char i18npathbuf[pathlen + 1]; + char path[pathlen + sizeof ("/charmaps")]; char *next; - i18npath = strdupa (i18npath); + i18npath = memcpy (i18npathbuf, i18npath, pathlen + 1); while (cmfile == NULL && (next = strsep (&i18npath, ":")) != NULL) diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index ca2ca1eaca..ed8fa919d5 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.org>, 1995. @@ -887,10 +887,11 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap, struct locale_ctype_t *ctype = locale->categories[LC_CTYPE].ctype; const size_t nelems = (_NL_ITEM_INDEX (_NL_CTYPE_EXTRA_MAP_1) + ctype->nr_charclass + ctype->map_collection_nr); - struct iovec iov[2 + nelems + 2 * ctype->nr_charclass - + ctype->map_collection_nr + 4]; + struct iovec *iov = alloca (sizeof *iov + * (2 + nelems + 2 * ctype->nr_charclass + + ctype->map_collection_nr + 4)); struct locale_file data; - uint32_t idx[nelems + 1]; + uint32_t *idx = alloca (sizeof *idx * (nelems + 1)); uint32_t default_missing_len; size_t elem, cnt, offset, total; char *cp; diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c index f0a0f0fff7..a7dd25c80d 100644 --- a/locale/programs/ld-time.c +++ b/locale/programs/ld-time.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.org>, 1995. @@ -528,10 +528,11 @@ time_output (struct localedef_t *locale, const struct charmap_t *charmap, const char *output_path) { struct locale_time_t *time = locale->categories[LC_TIME].time; - struct iovec iov[2 + _NL_ITEM_INDEX (_NL_NUM_LC_TIME) - + time->num_era - 1 - + 2 * 99 - + 2 + time->num_era * 10 - 1]; + struct iovec *iov = alloca (sizeof *iov + * (2 + _NL_ITEM_INDEX (_NL_NUM_LC_TIME) + + time->num_era - 1 + + 2 * 99 + + 2 + time->num_era * 10 - 1)); struct locale_file data; uint32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_TIME)]; size_t cnt, last_idx, num, n; diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c index e10f236815..1a1c7701d1 100644 --- a/locale/programs/locarchive.c +++ b/locale/programs/locarchive.c @@ -238,7 +238,6 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) size_t prefix_len = output_prefix ? strlen (output_prefix) : 0; char archivefname[prefix_len + sizeof (ARCHIVE_NAME)]; char fname[prefix_len + sizeof (ARCHIVE_NAME) + sizeof (".XXXXXX") - 1]; - struct oldlocrecent *oldlocrecarray; if (output_prefix) memcpy (archivefname, output_prefix, prefix_len); @@ -341,9 +340,7 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) + head->locrectab_offset); /* Sort the old locrec table in order of data position. */ - oldlocrecarray = (struct oldlocrecent *) - alloca (head->namehash_size - * sizeof (struct oldlocrecent)); + struct oldlocrecent oldlocrecarray[head->namehash_size]; for (cnt = 0, loccnt = 0; cnt < head->namehash_size; ++cnt) if (oldnamehashtab[cnt].locrec_offset != 0) { diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c index 2eeed96141..1d3276a6bf 100644 --- a/locale/programs/locfile.c +++ b/locale/programs/locfile.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.org>, 1996. @@ -64,11 +64,12 @@ locfile_read (struct localedef_t *result, const struct charmap_t *charmap) char *i18npath = getenv ("I18NPATH"); if (i18npath != NULL && *i18npath != '\0') { - char path[strlen (filename) + 1 + strlen (i18npath) - + sizeof ("/locales/") - 1]; + const size_t pathlen = strlen (i18npath); + char i18npathbuf[pathlen + 1]; + char path[strlen (filename) + 1 + pathlen + + sizeof ("/locales/") - 1]; char *next; - i18npath = strdupa (i18npath); - + i18npath = memcpy (i18npathbuf, i18npath, pathlen + 1); while (ldfile == NULL && (next = strsep (&i18npath, ":")) != NULL) diff --git a/locale/programs/repertoire.c b/locale/programs/repertoire.c index 8251db43d3..933b88f5cd 100644 --- a/locale/programs/repertoire.c +++ b/locale/programs/repertoire.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998,1999,2000,2001,2002,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -80,11 +80,12 @@ repertoire_read (const char *filename) char *i18npath = getenv ("I18NPATH"); if (i18npath != NULL && *i18npath != '\0') { - char path[strlen (filename) + 1 + strlen (i18npath) + const size_t pathlen = strlen (i18npath); + char i18npathbuf[pathlen + 1]; + char path[strlen (filename) + 1 + pathlen + sizeof ("/repertoiremaps/") - 1]; char *next; - i18npath = strdupa (i18npath); - + i18npath = memcpy (i18npathbuf, i18npath, pathlen + 1); while (repfile == NULL && (next = strsep (&i18npath, ":")) != NULL) |