aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-06-03 22:46:17 +0000
committerRoland McGrath <roland@gnu.org>1996-06-03 22:46:17 +0000
commit5f2eab4263a916625b42d6ad6990ca0f658bca88 (patch)
treefeab32882be0f3d49089a3f4d203aeb37a072e22
parent20328c396217915d148013fd8f119aeb9ed2da0c (diff)
downloadglibc-5f2eab4263a916625b42d6ad6990ca0f658bca88.zip
glibc-5f2eab4263a916625b42d6ad6990ca0f658bca88.tar.gz
glibc-5f2eab4263a916625b42d6ad6990ca0f658bca88.tar.bz2
Mon Jun 3 21:03:54 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* malloc/mcheck.c (freehook, reallochook): Handle null pointer args. * hurd/hurdsig.c (_hurd_internal_post_signal): When setting ACT to `ignore, resume the thread if SS_SUSPENDED, regardless of old action. Sun Jun 2 20:14:30 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * locale/programs/linereader.c (lr_open): Don't pass NULL to xstrdup; fix memory leak. (lr_close): Fix memory leak. * hurd/hurdsig.c (_hurd_internal_post_signal): When turning the action Mon Jun 3 01:29:53 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> * elf/link.h (struct link_map): Replace l_deps_loaded flag member with `struct link_map **l_searchlist'. * elf/dl-lookup.c (_dl_lookup_symbol): Make SYMBOL_SCOPE arg an array of two link_map ptrs. Search the maps in the l_searchlist of each of the two elts that is non-null. * elf/dl-reloc.c (_dl_relocate_object): Pass proper SCOPE array. * elf/dl-runtime.c: Likewise. * elf/dlsym.c: Likewise. * elf/rtld.c (dl_main): Likewise.
-rw-r--r--ChangeLog28
-rw-r--r--hurd/hurdsig.c2
-rw-r--r--intl/dcgettext.c56
-rw-r--r--intl/l10nflist.c79
-rw-r--r--intl/loadmsgcat.c12
-rw-r--r--intl/localealias.c55
6 files changed, 213 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index a846ff9..77bfb70 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,13 +1,39 @@
+Mon Jun 3 21:03:54 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
+
+ * malloc/mcheck.c (freehook, reallochook): Handle null pointer args.
+
+ * hurd/hurdsig.c (_hurd_internal_post_signal): When setting ACT to
+ `ignore, resume the thread if SS_SUSPENDED, regardless of old action.
+
+Sun Jun 2 20:14:30 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * locale/programs/linereader.c (lr_open): Don't pass NULL to
+ xstrdup; fix memory leak.
+ (lr_close): Fix memory leak.
+
Mon Jun 3 15:58:22 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu>
- * hurdsig.c (_hurd_internal_post_signal): When turning the action
+ * hurd/hurdsig.c (_hurd_internal_post_signal): When turning the action
for a HANDLE signal to IGNORE because the signal is blocked, clean
up any pending suspension left over from a call to resume.
+Mon Jun 3 01:29:53 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
+
+ * elf/link.h (struct link_map): Replace l_deps_loaded flag member with
+ `struct link_map **l_searchlist'.
+ * elf/dl-lookup.c (_dl_lookup_symbol): Make SYMBOL_SCOPE arg an array
+ of two link_map ptrs. Search the maps in the l_searchlist of each
+ of the two elts that is non-null.
+ * elf/dl-reloc.c (_dl_relocate_object): Pass proper SCOPE array.
+ * elf/dl-runtime.c: Likewise.
+ * elf/dlsym.c: Likewise.
+ * elf/rtld.c (dl_main): Likewise.
+
Mon Jun 3 00:30:35 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* elf/dl-lookup.c (_dl_lookup_symbol): Take new arg RELOC_ADDR and
don't allow a defn resolving to that address.
+
* elf/link.h: Update prototype and comment.
* elf/dl-runtime.c (fixup): Define local `resolve' function and pass
it to elf_machine_relplt.
diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index ffdc996..6abad33 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -680,7 +680,7 @@ _hurd_internal_post_signal (struct hurd_sigstate *ss,
/* If there was a call to resume above in SIGCONT processing
and we've left a thread suspended, now's the time to
set it going. */
- if (act == handle && ss_suspended)
+ if (ss_suspended)
{
err = __thread_resume (ss->thread);
assert_perror (err);
diff --git a/intl/dcgettext.c b/intl/dcgettext.c
index a18be16..5c14dca 100644
--- a/intl/dcgettext.c
+++ b/intl/dcgettext.c
@@ -1,6 +1,8 @@
/* dcgettext.c -- implementation of the dcgettext(3) function
-Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+ Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+
+This file is part of the GNU C Library. Its master source is NOT part of
+the C library, however. The master source lives in /gd/gnu/lib.
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
@@ -14,8 +16,8 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -160,6 +162,42 @@ static const char *guess_category_value PARAMS ((int category,
const char *categoryname));
+/* For those loosing systems which don't have `alloca' we have to add
+ some additional code emulating it. */
+#ifdef HAVE_ALLOCA
+/* Nothing has to be done. */
+# define ADD_BLOCK(list, address) /* nothing */
+# define FREE_BLOCKS(list) /* nothing */
+#else
+struct block_list
+{
+ void *address;
+ struct block_list *next;
+};
+# define ADD_BLOCK(list, addr) \
+ do { \
+ struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
+ /* If we cannot get a free block we cannot add the new element to \
+ the list. */ \
+ if (newp != NULL) { \
+ newp->address = (addr); \
+ newp->next = (list); \
+ (list) = newp; \
+ } \
+ } while (0)
+# define FREE_BLOCKS(list) \
+ do { \
+ while (list != NULL) { \
+ struct block_list *old = list; \
+ list = list->next; \
+ free (old); \
+ } \
+ } while (0)
+# undef alloca
+# define alloca(size) (malloc (size))
+#endif /* have alloca */
+
+
/* Names for the libintl functions are a problem. They must not clash
with existing names and they should follow ANSI C. But this source
code is also used in GNU C Library where the names have a __
@@ -178,6 +216,9 @@ DCGETTEXT (domainname, msgid, category)
const char *msgid;
int category;
{
+#ifndef HAVE_ALLOCA
+ struct block_list *alloca_list = NULL;
+#endif
struct loaded_l10nfile *domain;
struct binding *binding;
const char *categoryname;
@@ -227,12 +268,14 @@ DCGETTEXT (domainname, msgid, category)
path_max += 2; /* The getcwd docs say to do this. */
dirname = (char *) alloca (path_max + dirname_len);
+ ADD_BLOCK (block_list, dirname);
errno = 0;
while ((ret = getcwd (dirname, path_max)) == NULL && errno == ERANGE)
{
path_max += PATH_INCR;
dirname = (char *) alloca (path_max + dirname_len);
+ ADD_BLOCK (block_list, dirname);
errno = 0;
}
@@ -240,6 +283,7 @@ DCGETTEXT (domainname, msgid, category)
{
/* We cannot get the current working directory. Don't signal an
error but simply return the default string. */
+ FREE_BLOCKS (block_list);
errno = saved_errno;
return (char *) msgid;
}
@@ -262,6 +306,7 @@ DCGETTEXT (domainname, msgid, category)
xdomainname = (char *) alloca (strlen (categoryname)
+ strlen (domainname) + 5);
+ ADD_BLOCK (block_list, xdomainname);
/* We don't want libintl.a to depend on any other library. So we
avoid the non-standard function stpcpy. In GNU C Library this
function is available, though. Also allow the symbol HAVE_STPCPY
@@ -279,6 +324,7 @@ DCGETTEXT (domainname, msgid, category)
/* Creating working area. */
single_locale = (char *) alloca (strlen (categoryvalue) + 1);
+ ADD_BLOCK (block_list, single_locale);
/* Search for the given string. This is a loop because we perhaps
@@ -310,6 +356,7 @@ DCGETTEXT (domainname, msgid, category)
if (strcmp (single_locale, "C") == 0
|| strcmp (single_locale, "POSIX") == 0)
{
+ FREE_BLOCKS (block_list);
errno = saved_errno;
return (char *) msgid;
}
@@ -338,6 +385,7 @@ DCGETTEXT (domainname, msgid, category)
if (retval != NULL)
{
+ FREE_BLOCKS (block_list);
errno = saved_errno;
return retval;
}
diff --git a/intl/l10nflist.c b/intl/l10nflist.c
index b0fdf51..00e3c89 100644
--- a/intl/l10nflist.c
+++ b/intl/l10nflist.c
@@ -1,7 +1,9 @@
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+This file is part of the GNU C Library. Its master source is NOT part of
+the C library, however. The master source lives in /gd/gnu/lib.
+
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
published by the Free Software Foundation; either version 2 of the
@@ -14,16 +16,83 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
-#include <argz.h>
+#if defined _LIBC && (defined __ARGZ_COUNT || defined __ARGZ_STRINGIFY)
+# include <argz.h>
+#endif
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "loadinfo.h"
+/* Define function which are usually not available. */
+
+#if !defined _LIBC && !defined __ARGZ_COUNT
+/* Returns the number of strings in ARGZ. */
+static size_t __argz_count __P ((const char *argz, size_t len));
+
+static size_t
+__argz_count (argz, len)
+ const char *argz;
+ size_t len;
+{
+ size_t count = 0;
+ while (len > 0)
+ {
+ size_t part_len = strlen(argz);
+ argz += part_len + 1;
+ len -= part_len + 1;
+ count++;
+ }
+ return count;
+}
+#endif /* !_LIBC && !__ARGZ_COUNT */
+
+#if !defined _LIBC && !defined __ARGZ_STRINGIFY
+/* Make '\0' separated arg vector ARGZ printable by converting all the '\0's
+ except the last into the character SEP. */
+static void __argz_stringify __P ((char *argz, size_t len, int sep));
+
+static void
+__argz_stringify (argz, len, sep)
+ char *argz;
+ size_t len;
+ int sep;
+{
+ while (len > 0)
+ {
+ size_t part_len = strlen(argz);
+ argz += part_len;
+ len -= part_len + 1;
+ if (len > 0)
+ *argz++ = sep;
+ }
+}
+#endif /* !_LIBC && !__ARGZ_COUNT */
+
+#if !defined _LIBC && !defined __ARGZ_NEXT
+static char *
+__argz_next (char *argz, size_t argz_len, const char *entry)
+{
+ if (entry)
+ {
+ if (entry < argz + argz_len)
+ entry = strchr (entry, '\0') + 1;
+
+ return entry >= argz + argz_len ? NULL : (char *) entry;
+ }
+ else
+ if (argz_len > 0)
+ return argz;
+ else
+ return 0;
+}
+#endif
+
+
/* Return number of bits set in X. */
static int pop __P ((int x));
@@ -40,7 +109,7 @@ pop (x)
return x;
}
-
+
struct loaded_l10nfile *
_nl_make_l10nflist (l10nfile_list, dirlist, dirlist_len, mask, language,
territory, codeset, normalized_codeset, modifier, special,
diff --git a/intl/loadmsgcat.c b/intl/loadmsgcat.c
index 90eed87..4a60f6b 100644
--- a/intl/loadmsgcat.c
+++ b/intl/loadmsgcat.c
@@ -1,6 +1,8 @@
/* loadmsgcat.c -- load needed message catalogs
-Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
+ Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+
+This file is part of the GNU C Library. Its master source is NOT part of
+the C library, however. The master source lives in /gd/gnu/lib.
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
@@ -14,8 +16,8 @@ Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
@@ -160,7 +162,7 @@ _nl_load_domain (domain_file)
}
domain_file->data
- = (struct loaded_domain *) malloc (sizeof (struct loaded_domain *));
+ = (struct loaded_domain *) malloc (sizeof (struct loaded_domain));
if (domain_file->data == NULL)
return;
diff --git a/intl/localealias.c b/intl/localealias.c
index 17b912a..57c4a01 100644
--- a/intl/localealias.c
+++ b/intl/localealias.c
@@ -77,6 +77,41 @@ void free ();
# define strcasecmp __strcasecmp
#endif
+
+/* For those loosing systems which don't have `alloca' we have to add
+ some additional code emulating it. */
+#ifdef HAVE_ALLOCA
+/* Nothing has to be done. */
+# define ADD_BLOCK(list, address) /* nothing */
+# define FREE_BLOCKS(list) /* nothing */
+#else
+struct block_list
+{
+ void *address;
+ struct block_list *next;
+};
+# define ADD_BLOCK(list, addr) \
+ do { \
+ struct block_list *newp = (struct block_list *) malloc (sizeof (*newp)); \
+ /* If we cannot get a free block we cannot add the new element to \
+ the list. */ \
+ if (newp != NULL) { \
+ newp->address = (addr); \
+ newp->next = (list); \
+ (list) = newp; \
+ } \
+ } while (0)
+# define FREE_BLOCKS(list) \
+ do { \
+ while (list != NULL) { \
+ struct block_list *old = list; \
+ list = list->next; \
+ free (old); \
+ } \
+ } while (0)
+#endif /* have alloca */
+
+
struct alias_map
{
const char *alias;
@@ -151,18 +186,25 @@ read_alias_file (fname, fname_len)
const char *fname;
int fname_len;
{
+#ifndef HAVE_ALLOCA
+ struct block_list *alloca_list = NULL;
+#endif
FILE *fp;
char *full_fname;
size_t added;
static const char aliasfile[] = "/locale.alias";
full_fname = (char *) alloca (fname_len + sizeof aliasfile);
+ ADD_BLOCK (block_list, full_fname);
memcpy (full_fname, fname, fname_len);
memcpy (&full_fname[fname_len], aliasfile, sizeof aliasfile);
fp = fopen (full_fname, "r");
if (fp == NULL)
- return 0;
+ {
+ FREE_BLOCKS (block_list);
+ return 0;
+ }
added = 0;
while (!feof (fp))
@@ -227,14 +269,20 @@ read_alias_file (fname, fname_len)
len = strlen (alias) + 1;
tp = (char *) malloc (len);
if (tp == NULL)
- return added;
+ {
+ FREE_BLOCKS (block_list);
+ return added;
+ }
memcpy (tp, alias, len);
map[nmap].alias = tp;
len = strlen (value) + 1;
tp = (char *) malloc (len);
if (tp == NULL)
- return added;
+ {
+ FREE_BLOCKS (block_list);
+ return added;
+ }
memcpy (tp, value, len);
map[nmap].value = tp;
@@ -263,6 +311,7 @@ read_alias_file (fname, fname_len)
qsort (map, nmap, sizeof (struct alias_map),
(int (*) PARAMS ((const void *, const void *))) alias_compare);
+ FREE_BLOCKS (block_list);
return added;
}