mirror of git://sourceware.org/git/glibc.git
unify xmalloc prototypes & friends
These prototypes are duplicated in many places. Add a dedicated header for holding prototypes for program-specific functions to avoid that. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
4bf6b9dd8e
commit
6ff444c418
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
2013-02-18 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
|
||||||
|
* include/programs/xmalloc.h: New file.
|
||||||
|
* catgets/gencat.c: Include it.
|
||||||
|
(xmalloc, xcalloc, xrealloc, xstrdup): Don't declare them.
|
||||||
|
* elf/pldd.c: Likewise.
|
||||||
|
* iconv/iconv_charmap.c: Likewise.
|
||||||
|
* iconv/iconvconfig.c: Likewise.
|
||||||
|
* iconv/strtab.c: Likewise.
|
||||||
|
* locale/programs/locale.c: Likewise.
|
||||||
|
* locale/programs/localedef.h: Likewise.
|
||||||
|
* locale/programs/simple-hash.c: Likewise.
|
||||||
|
* nscd/nscd.h: Likewise.
|
||||||
|
* nss/makedb.c: Likewise.
|
||||||
|
* sysdeps/generic/ldconfig.h: Likewise.
|
||||||
|
|
||||||
2013-02-18 Siddhesh Poyarekar <siddhesh@redhat.com>
|
2013-02-18 Siddhesh Poyarekar <siddhesh@redhat.com>
|
||||||
|
|
||||||
* Versions.def: Add GLIBC_2.18.
|
* Versions.def: Add GLIBC_2.18.
|
||||||
|
|
|
@ -137,13 +137,7 @@ static struct argp argp =
|
||||||
|
|
||||||
|
|
||||||
/* Wrapper functions with error checking for standard functions. */
|
/* Wrapper functions with error checking for standard functions. */
|
||||||
extern void *xmalloc (size_t n)
|
#include <programs/xmalloc.h>
|
||||||
__attribute_malloc__ __attribute_alloc_size (1);
|
|
||||||
extern void *xcalloc (size_t n, size_t s)
|
|
||||||
__attribute_malloc__ __attribute_alloc_size (1, 2);
|
|
||||||
extern void *xrealloc (void *o, size_t n)
|
|
||||||
__attribute_malloc__ __attribute_alloc_size (2);
|
|
||||||
extern char *xstrdup (const char *) __attribute_malloc__;
|
|
||||||
|
|
||||||
/* Prototypes for local functions. */
|
/* Prototypes for local functions. */
|
||||||
static void error_print (void);
|
static void error_print (void);
|
||||||
|
|
|
@ -43,10 +43,7 @@ extern char *program_invocation_short_name;
|
||||||
#define PACKAGE _libc_intl_domainname
|
#define PACKAGE _libc_intl_domainname
|
||||||
|
|
||||||
/* External functions. */
|
/* External functions. */
|
||||||
extern void *xmalloc (size_t n)
|
#include <programs/xmalloc.h>
|
||||||
__attribute_malloc__ __attribute_alloc_size (1);
|
|
||||||
extern void *xrealloc (void *o, size_t n)
|
|
||||||
__attribute_malloc__ __attribute_alloc_size (2);
|
|
||||||
|
|
||||||
/* Name and version of program. */
|
/* Name and version of program. */
|
||||||
static void print_version (FILE *stream, struct argp_state *state);
|
static void print_version (FILE *stream, struct argp_state *state);
|
||||||
|
|
|
@ -32,10 +32,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* Prototypes for a few program-wide used functions. */
|
/* Prototypes for a few program-wide used functions. */
|
||||||
extern void *xmalloc (size_t n)
|
#include <programs/xmalloc.h>
|
||||||
__attribute_malloc__ __attribute_alloc_size (1);
|
|
||||||
extern void *xcalloc (size_t n, size_t s)
|
|
||||||
__attribute_malloc__ __attribute_alloc_size (1, 2);
|
|
||||||
|
|
||||||
|
|
||||||
struct convtable
|
struct convtable
|
||||||
|
|
|
@ -247,12 +247,7 @@ static struct
|
||||||
static const char gconv_module_ext[] = MODULE_EXT;
|
static const char gconv_module_ext[] = MODULE_EXT;
|
||||||
|
|
||||||
|
|
||||||
extern void *xmalloc (size_t n)
|
#include <programs/xmalloc.h>
|
||||||
__attribute_malloc__ __attribute_alloc_size (1);
|
|
||||||
extern void *xcalloc (size_t n, size_t s)
|
|
||||||
__attribute_malloc__ __attribute_alloc_size (1, 2);
|
|
||||||
extern void *xrealloc (void *o, size_t n)
|
|
||||||
__attribute_malloc__ __attribute_alloc_size (2);
|
|
||||||
|
|
||||||
|
|
||||||
/* C string table handling. */
|
/* C string table handling. */
|
||||||
|
|
|
@ -65,8 +65,7 @@ struct Strtab
|
||||||
static size_t ps;
|
static size_t ps;
|
||||||
|
|
||||||
|
|
||||||
extern void *xmalloc (size_t n)
|
#include <programs/xmalloc.h>
|
||||||
__attribute_malloc__ __attribute_alloc_size (1);
|
|
||||||
|
|
||||||
/* Prototypes for our functions that are used from iconvconfig.c. If
|
/* Prototypes for our functions that are used from iconvconfig.c. If
|
||||||
you change these, change also iconvconfig.c. */
|
you change these, change also iconvconfig.c. */
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
/* Memory related definitions for program modules.
|
||||||
|
Copyright (C) 1998-2013 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published
|
||||||
|
by the Free Software Foundation; version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#ifndef _XMALLOC_H
|
||||||
|
#define _XMALLOC_H 1
|
||||||
|
|
||||||
|
#include <sys/cdefs.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
/* Prototypes for a few program-wide used functions. */
|
||||||
|
extern void *xmalloc (size_t n)
|
||||||
|
__attribute_malloc__ __attribute_alloc_size (1);
|
||||||
|
extern void *xcalloc (size_t n, size_t s)
|
||||||
|
__attribute_malloc__ __attribute_alloc_size (1, 2);
|
||||||
|
extern void *xrealloc (void *o, size_t n)
|
||||||
|
__attribute_malloc__ __attribute_alloc_size (2);
|
||||||
|
extern char *xstrdup (const char *) __attribute_malloc__;
|
||||||
|
|
||||||
|
#endif /* xmalloc.h */
|
|
@ -42,10 +42,7 @@
|
||||||
#include "localeinfo.h"
|
#include "localeinfo.h"
|
||||||
#include "charmap-dir.h"
|
#include "charmap-dir.h"
|
||||||
#include "../locarchive.h"
|
#include "../locarchive.h"
|
||||||
|
#include <programs/xmalloc.h>
|
||||||
extern void *xmalloc (size_t n)
|
|
||||||
__attribute_malloc__ __attribute_alloc_size (1);
|
|
||||||
extern char *xstrdup (const char *) __attribute_malloc__;
|
|
||||||
|
|
||||||
#define ARCHIVE_NAME LOCALEDIR "/locale-archive"
|
#define ARCHIVE_NAME LOCALEDIR "/locale-archive"
|
||||||
|
|
||||||
|
|
|
@ -120,13 +120,7 @@ extern const char *alias_file;
|
||||||
|
|
||||||
|
|
||||||
/* Prototypes for a few program-wide used functions. */
|
/* Prototypes for a few program-wide used functions. */
|
||||||
extern void *xmalloc (size_t n)
|
#include <programs/xmalloc.h>
|
||||||
__attribute_malloc__ __attribute_alloc_size (1);
|
|
||||||
extern void *xcalloc (size_t n, size_t s)
|
|
||||||
__attribute_malloc__ __attribute_alloc_size (1, 2);
|
|
||||||
extern void *xrealloc (void *o, size_t n)
|
|
||||||
__attribute_malloc__ __attribute_alloc_size (2);
|
|
||||||
extern char *xstrdup (const char *) __attribute_malloc__;
|
|
||||||
|
|
||||||
|
|
||||||
/* Wrapper to switch LC_CTYPE back to the locale specified in the
|
/* Wrapper to switch LC_CTYPE back to the locale specified in the
|
||||||
|
|
|
@ -52,10 +52,7 @@
|
||||||
#define hashval_t uint32_t
|
#define hashval_t uint32_t
|
||||||
#include "hashval.h"
|
#include "hashval.h"
|
||||||
|
|
||||||
extern void *xmalloc (size_t n)
|
#include <programs/xmalloc.h>
|
||||||
__attribute_malloc__ __attribute_alloc_size (1);
|
|
||||||
extern void *xcalloc (size_t n, size_t s)
|
|
||||||
__attribute_malloc__ __attribute_alloc_size (1, 2);
|
|
||||||
|
|
||||||
typedef struct hash_entry
|
typedef struct hash_entry
|
||||||
{
|
{
|
||||||
|
|
|
@ -200,12 +200,7 @@ extern gid_t old_gid;
|
||||||
/* Prototypes for global functions. */
|
/* Prototypes for global functions. */
|
||||||
|
|
||||||
/* Wrapper functions with error checking for standard functions. */
|
/* Wrapper functions with error checking for standard functions. */
|
||||||
extern void *xmalloc (size_t n)
|
#include <programs/xmalloc.h>
|
||||||
__attribute_malloc__ __attribute_alloc_size (1);
|
|
||||||
extern void *xcalloc (size_t n, size_t s)
|
|
||||||
__attribute_malloc__ __attribute_alloc_size (1, 2);
|
|
||||||
extern void *xrealloc (void *o, size_t n)
|
|
||||||
__attribute_malloc__ __attribute_alloc_size (2);
|
|
||||||
|
|
||||||
/* nscd.c */
|
/* nscd.c */
|
||||||
extern void termination_handler (int signum) __attribute__ ((__noreturn__));
|
extern void termination_handler (int signum) __attribute__ ((__noreturn__));
|
||||||
|
|
|
@ -173,10 +173,7 @@ static void reset_file_creation_context (void);
|
||||||
|
|
||||||
|
|
||||||
/* External functions. */
|
/* External functions. */
|
||||||
extern void *xmalloc (size_t n)
|
#include <programs/xmalloc.h>
|
||||||
__attribute_malloc__ __attribute_alloc_size (1);
|
|
||||||
extern void *xcalloc (size_t n, size_t s)
|
|
||||||
__attribute_malloc__ __attribute_alloc_size (1, 2);
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -84,12 +84,6 @@ extern int opt_verbose;
|
||||||
extern int opt_format;
|
extern int opt_format;
|
||||||
|
|
||||||
/* Prototypes for a few program-wide used functions. */
|
/* Prototypes for a few program-wide used functions. */
|
||||||
extern void *xmalloc (size_t n)
|
#include <programs/xmalloc.h>
|
||||||
__attribute_malloc__ __attribute_alloc_size (1);
|
|
||||||
extern void *xcalloc (size_t n, size_t s)
|
|
||||||
__attribute_malloc__ __attribute_alloc_size (1, 2);
|
|
||||||
extern void *xrealloc (void *o, size_t n)
|
|
||||||
__attribute_malloc__ __attribute_alloc_size (2);
|
|
||||||
extern char *xstrdup (const char *) __attribute_malloc__;
|
|
||||||
|
|
||||||
#endif /* ! _LDCONFIG_H */
|
#endif /* ! _LDCONFIG_H */
|
||||||
|
|
Loading…
Reference in New Issue