about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-08-04 21:58:10 +0000
committerUlrich Drepper <drepper@redhat.com>2004-08-04 21:58:10 +0000
commit7c11c4a14684f23babd5060931529f095b8f81d3 (patch)
tree1376da71d6f5dc84720637524c52f902c23c4681
parent01f7e9281469ade588b61111eac9911d9a48a1ff (diff)
downloadglibc-7c11c4a14684f23babd5060931529f095b8f81d3.tar.gz
glibc-7c11c4a14684f23babd5060931529f095b8f81d3.tar.xz
glibc-7c11c4a14684f23babd5060931529f095b8f81d3.zip
(do_release_all): Add __libc_freeres_fn_section.
-rw-r--r--elf/dl-close.c11
-rw-r--r--iconv/gconv_db.c9
-rw-r--r--iconv/gconv_dl.c5
-rw-r--r--locale/localeinfo.h3
-rw-r--r--locale/programs/linereader.c3
-rw-r--r--locale/setlocale.c10
-rw-r--r--nscd/connections.c2
-rw-r--r--stdio-common/printf_size.c11
-rw-r--r--stdio-common/tst-fmemopen.c2
9 files changed, 31 insertions, 25 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index 500b9d57d3..ca60ae5abe 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -565,7 +565,7 @@ libc_hidden_def (_dl_close)
 
 
 #ifdef USE_TLS
-static bool
+static bool __libc_freeres_fn_section
 free_slotinfo (struct dtv_slotinfo_list **elemp)
 {
   size_t cnt;
@@ -623,11 +623,12 @@ libc_freeres_fn (free_mem)
 	/* There was no initial TLS setup, it was set up later when
 	   it used the normal malloc.  */
 	free_slotinfo (&GL(dl_tls_dtv_slotinfo_list));
+      else
 # endif
-      /* The first element of the list does not have to be deallocated.
-	 It was allocated in the dynamic linker (i.e., with a different
-	 malloc), and in the static library it's in .bss space.  */
-      free_slotinfo (&GL(dl_tls_dtv_slotinfo_list)->next);
+        /* The first element of the list does not have to be deallocated.
+	   It was allocated in the dynamic linker (i.e., with a different
+	   malloc), and in the static library it's in .bss space.  */
+	free_slotinfo (&GL(dl_tls_dtv_slotinfo_list)->next);
     }
 #endif
 }
diff --git a/iconv/gconv_db.c b/iconv/gconv_db.c
index a21f8ddb3c..719ff95376 100644
--- a/iconv/gconv_db.c
+++ b/iconv/gconv_db.c
@@ -24,6 +24,7 @@
 #include <string.h>
 #include <sys/param.h>
 #include <bits/libc-lock.h>
+#include <locale/localeinfo.h>
 
 #include <dlfcn.h>
 #include <gconv_int.h>
@@ -170,7 +171,7 @@ add_derivation (const char *fromset, const char *toset,
      not all memory will be freed.  */
 }
 
-static void
+static void __libc_freeres_fn_section
 free_derivation (void *p)
 {
   struct known_derivation *deriv = (struct known_derivation *) p;
@@ -765,7 +766,7 @@ __gconv_close_transform (struct __gconv_step *steps, size_t nsteps)
 
 /* Free the modules mentioned.  */
 static void
-internal_function
+internal_function __libc_freeres_fn_section
 free_modules_db (struct gconv_module *node)
 {
   if (node->left != NULL)
@@ -786,6 +787,10 @@ free_modules_db (struct gconv_module *node)
 /* Free all resources if necessary.  */
 libc_freeres_fn (free_mem)
 {
+  /* First free locale memory.  This needs to be done before freeing derivations,
+     as ctype cleanup functions dereference steps arrays which we free below.  */
+  _nl_locale_subfreeres ();
+
   if (__gconv_alias_db != NULL)
     __tdestroy (__gconv_alias_db, free);
 
diff --git a/iconv/gconv_dl.c b/iconv/gconv_dl.c
index cc7627aba2..9504017210 100644
--- a/iconv/gconv_dl.c
+++ b/iconv/gconv_dl.c
@@ -1,5 +1,6 @@
 /* Handle loading/unloading of shared object for transformation.
-   Copyright (C) 1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc.
+   Copyright (C) 1997, 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>, 1997.
 
@@ -191,7 +192,7 @@ __gconv_release_shlib (struct __gconv_loaded_object *handle)
 
 
 /* We run this if we debug the memory allocation.  */
-static void
+static void __libc_freeres_fn_section
 do_release_all (void *nodep)
 {
   struct __gconv_loaded_object *obj = (struct __gconv_loaded_object *) nodep;
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index e7b8f84da8..065ee18cf9 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -315,6 +315,9 @@ extern struct locale_data *_nl_load_locale_from_archive (int category,
 /* Subroutine of setlocale's __libc_subfreeres hook.  */
 extern void _nl_archive_subfreeres (void) attribute_hidden;
 
+/* Subroutine of gconv-db's __libc_subfreeres hook.  */
+extern void _nl_locale_subfreeres (void) attribute_hidden;
+
 /* Validate the contents of a locale file and set up the in-core
    data structure to point into the data.  This leaves the `alloc'
    and `name' fields uninitialized, for the caller to fill in.
diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c
index c3865e4dd5..233799a87d 100644
--- a/locale/programs/linereader.c
+++ b/locale/programs/linereader.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.
 
@@ -80,6 +80,7 @@ lr_create (FILE *fp, const char *fname, kw_hash_fct_t hf)
   result->comment_char = '#';
   result->escape_char = '\\';
   result->translate_strings = 1;
+  result->return_widestr = 0;
 
   n = getdelim (&result->buf, &result->bufsize, '\n', result->fp);
   if (n < 0)
diff --git a/locale/setlocale.c b/locale/setlocale.c
index d012d0265f..e6db70d4c7 100644
--- a/locale/setlocale.c
+++ b/locale/setlocale.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991, 92, 1995-2000, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1995-2000, 2002, 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
@@ -444,7 +445,7 @@ setlocale (int category, const char *locale)
 }
 libc_hidden_def (setlocale)
 
-static void
+static void __libc_freeres_fn_section
 free_category (int category,
 	       struct locale_data *here, struct locale_data *c_data)
 {
@@ -472,7 +473,10 @@ free_category (int category,
     }
 }
 
-libc_freeres_fn (free_mem)
+/* This is called from iconv/gconv_db.c's free_mem, as locales must
+   be freed before freeing gconv steps arrays.  */
+void __libc_freeres_fn_section
+_nl_locale_subfreeres (void)
 {
 #ifdef NL_CURRENT_INDIRECT
   /* We don't use the loop because we want to have individual weak
diff --git a/nscd/connections.c b/nscd/connections.c
index 9db9b150ed..f8efcc26ee 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -342,7 +342,7 @@ cannot handle old request version %d; current version is %d"),
     {
       if (req->type == INVALIDATE)
 	dbg_log ("\t%s (%s)", serv2str[req->type], (char *)key);
-      else if (req > LASTDBREQ && req < LASTREQ)
+      else if (req->type > LASTDBREQ && req->type < LASTREQ)
 	dbg_log ("\t%s", serv2str[req->type]);
       else
 	dbg_log (_("\tinvalid request type %d"), req->type);
diff --git a/stdio-common/printf_size.c b/stdio-common/printf_size.c
index 3c7ac354e7..32f262ead0 100644
--- a/stdio-common/printf_size.c
+++ b/stdio-common/printf_size.c
@@ -201,18 +201,9 @@ printf_size (FILE *fp, const struct printf_info *info, const void *const *args)
 
   /* Prepare to print the number.  We want to use `__printf_fp' so we
      have to prepare a `printf_info' structure.  */
+  fp_info = *info;
   fp_info.spec = 'f';
   fp_info.prec = info->prec < 0 ? 3 : info->prec;
-  fp_info.is_long_double = info->is_long_double;
-  fp_info.is_short = info->is_short;
-  fp_info.is_long = info->is_long;
-  fp_info.alt = info->alt;
-  fp_info.space = info->space;
-  fp_info.left = info->left;
-  fp_info.showsign = info->showsign;
-  fp_info.group = info->group;
-  fp_info.extra = info->extra;
-  fp_info.pad = info->pad;
   fp_info.wide = wide;
 
   if (fp_info.left && fp_info.pad == L' ')
diff --git a/stdio-common/tst-fmemopen.c b/stdio-common/tst-fmemopen.c
index 84ded4f599..3c06c45c78 100644
--- a/stdio-common/tst-fmemopen.c
+++ b/stdio-common/tst-fmemopen.c
@@ -62,7 +62,7 @@ main (void)
     exit (4);
 
   if ((mmap_data = (char *) mmap (NULL, fs.st_size, PROT_READ,
-				  MAP_SHARED, fd, 0)) == NULL)
+				  MAP_SHARED, fd, 0)) == MAP_FAILED)
     {
       if (errno == ENOSYS)
 	exit (0);