* Makerules ($(common-objpfx)shlib.lds): Don't use \n in rhs of sed
authorRoland McGrath <roland@gnu.org>
Thu, 25 Mar 2004 03:54:03 +0000 (03:54 +0000)
committerRoland McGrath <roland@gnu.org>
Thu, 25 Mar 2004 03:54:03 +0000 (03:54 +0000)
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.

20 files changed:
ChangeLog
Makerules
elf/dl-deps.c
elf/dl-misc.c
iconv/gconv_int.h
intl/loadmsgcat.c
locale/programs/charmap.c
locale/programs/ld-ctype.c
locale/programs/ld-time.c
locale/programs/locarchive.c
locale/programs/locfile.c
locale/programs/repertoire.c
nis/nis_print_group_entry.c
nptl/ChangeLog
nptl/sysdeps/i386/pthread_spin_lock.c
nptl_db/ChangeLog
nptl_db/fetch-value.c
nptl_db/thread_dbP.h
posix/annexc.c
wcsmbs/wcsmbsload.c

index 79b2f9f..ccc96a3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
 2004-03-24  Roland McGrath  <roland@redhat.com>
 
+       * 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.
+
        * Makefile ($(objpfx)c++-types-check.out): Reduce duplication in
        defining this target.  Also elide -Wstrict-prototypes from CFLAGS.
 
index 970d1a4..a0eb30a 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -491,15 +491,15 @@ $(common-objpfx)shlib.lds: $(common-objpfx)config.make $(..)Makerules
                 PROVIDE(__start___libc_freeres_ptrs = .); \
                 *(__libc_freeres_ptrs) \
                 PROVIDE(__stop___libc_freeres_ptrs = .);/'\
-             -e 's/^.*\*(\.jcr).*$$/&\n\
-                PROVIDE(__start___libc_subfreeres = .);\n\
-                __libc_subfreeres : { *(__libc_subfreeres) }\n\
-                PROVIDE(__stop___libc_subfreeres = .);\n\
-                PROVIDE(__start___libc_atexit = .);\n\
-                __libc_atexit : { *(__libc_atexit) }\n\
-                PROVIDE(__stop___libc_atexit = .);\n\
-                PROVIDE(__start___libc_thread_subfreeres = .);\n\
-                __libc_thread_subfreeres : { *(__libc_thread_subfreeres) }\n\
+             -e 's/^.*\*(\.jcr).*$$/& \
+                PROVIDE(__start___libc_subfreeres = .);\
+                __libc_subfreeres : { *(__libc_subfreeres) }\
+                PROVIDE(__stop___libc_subfreeres = .);\
+                PROVIDE(__start___libc_atexit = .);\
+                __libc_atexit : { *(__libc_atexit) }\
+                PROVIDE(__stop___libc_atexit = .);\
+                PROVIDE(__start___libc_thread_subfreeres = .);\
+                __libc_thread_subfreeres : { *(__libc_thread_subfreeres) }\
                 PROVIDE(__stop___libc_thread_subfreeres = .);/'
        mv -f $@T $@
 common-generated += shlib.lds
index 1c383b7..b8dee8a 100644 (file)
@@ -144,7 +144,7 @@ _dl_map_object_deps (struct link_map *map,
                     struct link_map **preloads, unsigned int npreloads,
                     int trace_mode, int open_mode)
 {
-  struct list known[1 + npreloads + 1];
+  struct list *known = __alloca (sizeof *known * (1 + npreloads + 1));
   struct list *runp, *tail;
   unsigned int nlist, i;
   /* Object name.  */
index abc5cbb..41ef261 100644 (file)
@@ -88,8 +88,8 @@ _dl_sysdep_read_whole_file (const char *file, size_t *sizep, int prot)
 static void
 _dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg)
 {
-  const int niovmax = 64;
-  struct iovec iov[niovmax];
+# define NIOVMAX 64
+  struct iovec iov[NIOVMAX];
   int niov = 0;
   pid_t pid = 0;
   char pidbuf[12];
@@ -115,7 +115,7 @@ _dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg)
            }
 
          /* Append to the output.  */
-         assert (niov < niovmax);
+         assert (niov < NIOVMAX);
          iov[niov].iov_len = 12;
          iov[niov++].iov_base = pidbuf;
 
@@ -128,7 +128,7 @@ _dl_debug_vdprintf (int fd, int tag_p, const char *fmt, va_list arg)
        ++fmt;
 
       /* Append constant string.  */
-      assert (niov < niovmax);
+      assert (niov < NIOVMAX);
       if ((iov[niov].iov_len = fmt - startp) != 0)
        iov[niov++].iov_base = (char *) startp;
 
index 782e16a..36d4ae2 100644 (file)
@@ -137,7 +137,7 @@ __libc_lock_define (extern, __gconv_lock);
     char *result;                                                            \
     char *tmp;                                                               \
     size_t cnt = 0;                                                          \
-    size_t suffix_len = (suffix) == NULL ? 0 : strlen (suffix);                      \
+    const size_t suffix_len = strlen (suffix);                               \
                                                                              \
     while (*cp != '\0')                                                              \
       if (*cp++ == '/')                                                              \
@@ -153,7 +153,7 @@ __libc_lock_define (extern, __gconv_lock);
        if (cnt < 1)                                                          \
          {                                                                   \
            *tmp++ = '/';                                                     \
-           if (suffix != NULL)                                               \
+           if (suffix_len != 0)                                              \
              tmp = __mempcpy (tmp, suffix, suffix_len);                      \
          }                                                                   \
       }                                                                              \
index d70d77e..a9c257c 100644 (file)
@@ -832,7 +832,7 @@ _nl_init_domain_conv (domain_file, domain, domainbinding)
 # ifdef _LIBC
          /* We always want to use transliteration.  */
          outcharset = norm_add_slashes (outcharset, "TRANSLIT");
-         charset = norm_add_slashes (charset, NULL);
+         charset = norm_add_slashes (charset, "");
          if (__gconv_open (outcharset, charset, &domain->conv,
                            GCONV_AVOID_NOCONV)
              != __GCONV_OK)
index 8c9e4e9..8dbac6f 100644 (file)
@@ -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)
index ca2ca1e..ed8fa91 100644 (file)
@@ -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;
index f0a0f0f..a7dd25c 100644 (file)
@@ -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;
index e10f236..1a1c770 100644 (file)
@@ -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)
       {
index 2eeed96..1d3276a 100644 (file)
@@ -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)
index 8251db4..933b88f 100644 (file)
@@ -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)
index b32b3c2..6f0ba8f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 1997, 1998, 2000 Free Software Foundation, Inc.
+/* Copyright (c) 1997, 1998, 2000, 2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -31,10 +31,6 @@ nis_print_group_entry (const_nis_name group)
       char buf[grouplen + 50];
       char leafbuf[grouplen + 3];
       char domainbuf[grouplen + 3];
-      unsigned long mem_exp_cnt = 0, mem_imp_cnt = 0, mem_rec_cnt = 0;
-      unsigned long nomem_exp_cnt = 0, nomem_imp_cnt = 0, nomem_rec_cnt = 0;
-      char **mem_exp, **mem_imp, **mem_rec;
-      char **nomem_exp, **nomem_imp, **nomem_rec;
       nis_result *res;
       char *cp, *cp2;
       u_int i;
@@ -56,12 +52,14 @@ nis_print_group_entry (const_nis_name group)
          (__type_of (NIS_RES_OBJECT (res)) != NIS_GROUP_OBJ))
        return;
 
-      mem_exp = alloca (sizeof (char *) * NIS_RES_NUMOBJ (res));
-      mem_imp = alloca (sizeof (char *) * NIS_RES_NUMOBJ (res));
-      mem_rec = alloca (sizeof (char *) * NIS_RES_NUMOBJ (res));
-      nomem_exp = alloca (sizeof (char *) * NIS_RES_NUMOBJ (res));
-      nomem_imp = alloca (sizeof (char *) * NIS_RES_NUMOBJ (res));
-      nomem_rec = alloca (sizeof (char *) * NIS_RES_NUMOBJ (res));
+      char *mem_exp[NIS_RES_NUMOBJ (res)];
+      char *mem_imp[NIS_RES_NUMOBJ (res)];
+      char *mem_rec[NIS_RES_NUMOBJ (res)];
+      char *nomem_exp[NIS_RES_NUMOBJ (res)];
+      char *nomem_imp[NIS_RES_NUMOBJ (res)];
+      char *nomem_rec[NIS_RES_NUMOBJ (res)];
+      unsigned long mem_exp_cnt = 0, mem_imp_cnt = 0, mem_rec_cnt = 0;
+      unsigned long nomem_exp_cnt = 0, nomem_imp_cnt = 0, nomem_rec_cnt = 0;
 
       for (i = 0;
           i < NIS_RES_OBJECT (res)->GR_data.gr_members.gr_members_len; ++i)
index 4b8e43d..b29f3b3 100644 (file)
@@ -1,3 +1,8 @@
+2004-03-24  Roland McGrath  <roland@redhat.com>
+
+       * sysdeps/i386/pthread_spin_lock.c (pthread_spin_lock): Use "m"
+       constraint instead of "0".
+
 2004-03-24  Ulrich Drepper  <drepper@redhat.com>
 
        * sysdeps/unix/sysv/linux/powerpc/lowlevellock.h
index f001fba..b41174e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002,2003,2004 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -43,7 +43,7 @@ pthread_spin_lock (lock)
        "jmp 2b\n\t"
        ".previous"
        : "=m" (*lock)
-       : "0" (*lock));
+       : "m" (*lock));
 
   return 0;
 }
index f7a081e..6f01f2b 100644 (file)
@@ -1,3 +1,8 @@
+2004-03-24  Roland McGrath  <roland@redhat.com>
+
+       * fetch-value.c (_td_locate_field): Cast DB_DESC_OFFSET to int32_t.
+       * thread_dbP.h (DB_DESC_OFFSET): Remove cast from definition.
+
 2004-03-13  Jakub Jelinek  <jakub@redhat.com>
 
        * db_info.c: Don't use TLS_TP_OFFSET in the #if, but
index 9d40b61..0d9bb0e 100644 (file)
@@ -1,5 +1,5 @@
 /* Helper routines for libthread_db.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004 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
@@ -78,7 +78,8 @@ _td_locate_field (td_thragent_t *ta,
   if (elemsize & 0xff000000U)
     elemsize = bswap_32 (elemsize);
 
-  *address += DB_DESC_OFFSET (desc) + (elemsize / 8 * (idx - (psaddr_t) 0));
+  *address += (int32_t) DB_DESC_OFFSET (desc);
+  *address += (elemsize / 8 * (idx - (psaddr_t) 0));
   return TD_OK;
 }
 
index 6426620..5504dd0 100644 (file)
@@ -1,5 +1,5 @@
 /* Private header for thread debug library
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004 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
@@ -66,7 +66,7 @@ extern int __td_debug attribute_hidden;
 
 #define DB_DESC_SIZE(desc)     ((desc)[0])
 #define DB_DESC_NELEM(desc)    ((desc)[1])
-#define DB_DESC_OFFSET(desc)   ((int32_t) (desc)[2])
+#define DB_DESC_OFFSET(desc)   ((desc)[2])
 #define DB_SIZEOF_DESC         (3 * sizeof (uint32_t))
 #define DB_DEFINE_DESC(name, size, nelem, offset) \
   const uint32_t name[3] = { (size), (nelem), (offset) }
index 3ade6d4..df5913a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1998, 2000, 2002, 2004 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
@@ -794,22 +794,15 @@ get_null_defines (void)
 static int
 check_header (const struct header *header, const char **except)
 {
-  char line[BUFSIZ], *command;
+  char line[BUFSIZ], command[sizeof fmt + strlen (header->name)
+                            + 2 * strlen (CC)
+                            + strlen (INC) + strlen (macrofile)];
   FILE *input;
   int result = 0;
   int found[header->nsyms];
   int i;
 
   memset (found, '\0', header->nsyms * sizeof (int));
-  command = alloca (sizeof fmt + strlen (header->name) + 2 * strlen (CC)
-                   + strlen (INC) + strlen (macrofile));
-
-
-  if (command == NULL)
-    {
-      puts ("No more memory.");
-      exit (1);
-    }
 
   printf ("=== %s ===\n", header->name);
   sprintf (command, fmt, header->name, CC, INC, CC, macrofile);
index 2fea6c3..e618895 100644 (file)
@@ -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.
 
@@ -179,7 +179,7 @@ __wcsmbs_load_conv (struct locale_data *new_category)
       /* Normalize the name and add the slashes necessary for a
         complete lookup.  */
       complete_name = norm_add_slashes (charset_name,
-                                       use_translit ? "TRANSLIT" : NULL);
+                                       use_translit ? "TRANSLIT" : "");
 
       /* It is not necessary to use transliteration in this direction
         since the internal character set is supposed to be able to