diff options
author | Roland McGrath <roland@gnu.org> | 2002-11-01 20:44:15 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2002-11-01 20:44:15 +0000 |
commit | c877418f2e806a5d2a07c036bb4ac192a53ccdbf (patch) | |
tree | 198ff8cab8ac7ddfa07b46091cbe4c4a1b50f876 /sysdeps | |
parent | aa9937f78c2a5c3b1496888e06b1925a4bd1aba8 (diff) | |
download | glibc-c877418f2e806a5d2a07c036bb4ac192a53ccdbf.tar.gz |
* include/libc-symbols.h (__libc_freeres_fn_section, libc_freeres_fn):
New macros.
* elf/dl-close.c (free_mem): Use libc_freeres_fn macro, remove
text_set_element.
* elf/dl-libc.c (free_mem): Likewise.
* iconv/gconv_conf.c (free_mem): Likewise.
* iconv/gconv_db.c (free_mem): Likewise.
* iconv/gconv_dl.c (free_mem): Likewise.
* iconv/gconv_cache.c (free_mem): Likewise.
* intl/finddomain.c (free_mem): Likewise.
* intl/dcigettext.c (free_mem): Likewise.
* locale/setlocale.c (free_mem): Likewise.
* misc/fstab.c (fstab_free): Likewise.
* nss/nsswitch.c (free_mem): Likewise.
* posix/regcomp.c (free_mem): Likewise.
* resolv/gai_misc.c (free_res): Likewise.
* stdlib/fmtmsg.c (free_mem): Likewise.
* sunrpc/clnt_perr.c (free_mem): Likewise.
* sysdeps/generic/setenv.c (free_mem): Likewise.
* sysdeps/unix/sysv/linux/shm_open.c (freeit): Likewise.
* sysdeps/pthread/aio_misc.c (free_res): Likewise.
* time/tzset.c (free_mem): Likewise.
* malloc/mtrace.c (release_libc_mem): Add __libc_freeres_fn_section.
* locale/loadarchive.c (_nl_archive_subfreeres): Likewise.
* malloc/set-freeres.c (__libc_freeres): Likewise.
* login/getutent.c: Include stdlib.h instead of stddef.h.
(buffer): Change into pointer to utmp, add libc_freeres_ptr.
(__getutent): Allocate buffer the first time it is run.
* login/getutid.c: Include stdlib.h instead of stddef.h.
(buffer): Change into pointer to utmp, add libc_freeres_ptr.
(__getutid): Allocate buffer the first time it is run.
* login/getutline.c: Include stdlib.h instead of stddef.h.
(buffer): Change into pointer to utmp, add libc_freeres_ptr.
(__getutline): Allocate buffer the first time it is run.
* malloc/mtrace.c (malloc_trace_buffer): Change into char *.
(mtrace): Allocate malloc_trace_buffer.
* resolv/nsap_addr.c (inet_nsap_ntoa): Decrease size of tmpbuf.
* resolv/ns_print.c (ns_sprintrrf): Decrease size of t.
* string/strerror.c: Include libintl.h and errno.h.
(buf): New variable.
(strerror): Only allocate buffer if actually needed (unknown error).
* time/tzfile.c (transitions): Add libc_freeres_ptr.
(freeres): Remove.
2002-10-25 Jakub Jelinek <jakub@redhat.com>
* include/libc-symbols.h (libc_freeres_ptr): New macro.
* malloc/set-freeres.c (__libc_freeres_ptrs): Define using
symbol_set_define.
(__libc_freeres): Free all pointers in that section.
* Makerules (build-shlib): Add $(LDSEDCMD-$(@F:lib%.so=%).so) to sed
commands when creating .lds script.
(LDSEDCMD-c.so): New variable.
* inet/rcmd.c (ahostbuf): Change into char *. Add libc_freeres_ptr.
(rcmd_af): Use strdup to allocate ahostbuf.
* inet/rexec.c (ahostbuf): Change into char *. Add libc_freeres_ptr.
(rexec_af): Use strdup to allocate ahostbuf.
* stdio-common/reg-printf.c (printf_funcs): Remove.
(__printf_arginfo_table): Change into printf_arginfo_function **.
Add libc_freeres_ptr.
(__register_printf_function): Allocate __printf_arginfo_table
and __printf_function_table the first time it is called.
* stdio-common/printf-parse.h (__printf_arginfo_table): Change into
printf_arginfo_function **.
(parse_one_spec): Add __builtin_expect.
* grp/fgetgrent.c (buffer): Add libc_freeres_ptr.
(free_mem): Remove.
* inet/getnetgrent.c (buffer): Add libc_freeres_ptr.
(free_mem): Remove.
* intl/localealias.c (libc_freeres_ptr): Define if !_LIBC.
(string_space, map): Add libc_freeres_ptr.
(free_mem): Remove.
* misc/efgcvt.c (FCVT_BUFPTR): Add libc_freeres_ptr.
(free_mem): Remove.
* misc/mntent.c (getmntent_buffer): Add libc_freeres_ptr.
(free_mem): Remove.
* crypt/md5-crypt.c (libc_freeres_ptr): Define if !_LIBC.
(buffer): Add libc_freeres_ptr.
(free_mem): Remove for _LIBC.
* nss/getXXbyYY.c (buffer): Add libc_freeres_ptr.
(free_mem): Remove.
* nss/getXXent.c (buffer): Add libc_freeres_ptr.
(free_mem): Remove.
* pwd/fgetpwent.c (buffer): Add libc_freeres_ptr.
(free_mem): Remove.
* resolv/res_hconf.c (ifaddrs): Add libc_freeres_ptr.
(free_mem): Remove.
* shadow/fgetspent.c (buffer): Add libc_freeres_ptr.
(free_mem): Remove.
* sysdeps/posix/ttyname.c (getttyname_name): Add libc_freeres_ptr.
(free_mem): Remove.
* sysdeps/unix/sysv/linux/getsysstats.c (mount_proc): Add
libc_freeres_ptr.
(free_mem): Remove.
* sysdeps/unix/sysv/linux/ttyname.c (getttyname_name, ttyname_buf): Add
libc_freeres_ptr.
(free_mem): Remove.
2002-10-30 Jakub Jelinek <jakub@redhat.com>
* malloc/obstack.c [_LIBC] (obstack_free): Change into strong_alias
instead of duplicating the whole function in libc.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/generic/setenv.c | 5 | ||||
-rw-r--r-- | sysdeps/posix/ttyname.c | 12 | ||||
-rw-r--r-- | sysdeps/pthread/aio_misc.c | 7 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/getsysstats.c | 10 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/shm_open.c | 10 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/ttyname.c | 13 |
6 files changed, 11 insertions, 46 deletions
diff --git a/sysdeps/generic/setenv.c b/sysdeps/generic/setenv.c index e5799e529d..e7fd49228c 100644 --- a/sysdeps/generic/setenv.c +++ b/sysdeps/generic/setenv.c @@ -323,8 +323,7 @@ clearenv () return 0; } #ifdef _LIBC -static void -free_mem (void) +libc_freeres_fn (free_mem) { /* Remove all traces. */ clearenv (); @@ -333,8 +332,6 @@ free_mem (void) __tdestroy (known_values, free); known_values = NULL; } -text_set_element (__libc_subfreeres, free_mem); - # undef setenv # undef unsetenv diff --git a/sysdeps/posix/ttyname.c b/sysdeps/posix/ttyname.c index e5c3b3fbe0..b7a5d85661 100644 --- a/sysdeps/posix/ttyname.c +++ b/sysdeps/posix/ttyname.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 92, 93, 96, 97, 98, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1991,92,93,96,97,98,2000,2002 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 @@ -32,7 +32,7 @@ static char *getttyname (int fd, dev_t mydev, ino_t myino, int save, int *dostat) internal_function; -static char *getttyname_name; +libc_freeres_ptr (static char *getttyname_name); static char * internal_function @@ -134,11 +134,3 @@ ttyname (fd) return name; } - - -static void -free_mem (void) -{ - free (getttyname_name); -} -text_set_element (__libc_subfreeres, free_mem); diff --git a/sysdeps/pthread/aio_misc.c b/sysdeps/pthread/aio_misc.c index b0432e6e0e..78cf764837 100644 --- a/sysdeps/pthread/aio_misc.c +++ b/sysdeps/pthread/aio_misc.c @@ -530,7 +530,7 @@ handle_fildes_io (void *arg) aiocbp->aiocb64.aio_offset)); else aiocbp->aiocb.__return_value = - TEMP_FAILURE_RETRY (pwrite (fildes, (const void *) + TEMP_FAILURE_RETRY (__libc_pwrite (fildes, (const void *) aiocbp->aiocb.aio_buf, aiocbp->aiocb.aio_nbytes, aiocbp->aiocb.aio_offset)); @@ -665,9 +665,7 @@ handle_fildes_io (void *arg) /* Free allocated resources. */ -static void -__attribute__ ((unused)) -free_res (void) +libc_freeres_fn (free_res) { size_t row; @@ -676,7 +674,6 @@ free_res (void) free (pool); } -text_set_element (__libc_subfreeres, free_res); /* Add newrequest to the runlist. The __abs_prio flag of newrequest must diff --git a/sysdeps/unix/sysv/linux/getsysstats.c b/sysdeps/unix/sysv/linux/getsysstats.c index eaacf3727c..55ef5b661a 100644 --- a/sysdeps/unix/sysv/linux/getsysstats.c +++ b/sysdeps/unix/sysv/linux/getsysstats.c @@ -38,7 +38,7 @@ static const char path_proc[] = "/proc"; /* Actual mount point of /proc filesystem. */ -static char *mount_proc; +libc_freeres_ptr (static char *mount_proc); /* Determine the path to the /proc filesystem if available. */ static const char * @@ -319,11 +319,3 @@ __get_avphys_pages () return phys_pages_info ("MemFree: %ld kB"); } weak_alias (__get_avphys_pages, get_avphys_pages) - - -static void -free_mem (void) -{ - free (mount_proc); -} -text_set_element (__libc_subfreeres, free_mem); diff --git a/sysdeps/unix/sysv/linux/shm_open.c b/sysdeps/unix/sysv/linux/shm_open.c index a96df2427c..b118533dca 100644 --- a/sysdeps/unix/sysv/linux/shm_open.c +++ b/sysdeps/unix/sysv/linux/shm_open.c @@ -226,14 +226,10 @@ shm_unlink (const char *name) } -static void __attribute__ ((unused)) -freeit (void) +/* Make sure the table is freed if we want to free everything before + exiting. */ +libc_freeres_fn (freeit) { if (mountpoint.dir != defaultdir) free (mountpoint.dir); } - - -/* Make sure the table is freed if we want to free everything before - exiting. */ -text_set_element (__libc_subfreeres, freeit); diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c index f8e6e925a4..68d24f195e 100644 --- a/sysdeps/unix/sysv/linux/ttyname.c +++ b/sysdeps/unix/sysv/linux/ttyname.c @@ -38,7 +38,7 @@ static char *getttyname (const char *dev, dev_t mydev, internal_function; -static char *getttyname_name; +libc_freeres_ptr (static char *getttyname_name); static char * internal_function @@ -103,7 +103,7 @@ getttyname (const char *dev, dev_t mydev, ino64_t myino, int save, int *dostat) /* Static buffer in `ttyname'. */ -static char *ttyname_buf; +libc_freeres_ptr (static char *ttyname_buf); /* Return the pathname of the terminal FD is open on, or NULL on errors. @@ -186,12 +186,3 @@ ttyname (int fd) return name; } - - -static void -free_mem (void) -{ - free (ttyname_buf); - free (getttyname_name); -} -text_set_element (__libc_subfreeres, free_mem); |