]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
unify xmalloc prototypes & friends
authorMike Frysinger <vapier@gentoo.org>
Sun, 30 Dec 2012 22:41:42 +0000 (17:41 -0500)
committerMike Frysinger <vapier@gentoo.org>
Mon, 18 Feb 2013 22:16:05 +0000 (17:16 -0500)
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>
13 files changed:
ChangeLog
catgets/gencat.c
elf/pldd.c
iconv/iconv_charmap.c
iconv/iconvconfig.c
iconv/strtab.c
include/programs/xmalloc.h [new file with mode: 0644]
locale/programs/locale.c
locale/programs/localedef.h
locale/programs/simple-hash.c
nscd/nscd.h
nss/makedb.c
sysdeps/generic/ldconfig.h

index 44e6955fbe997253744c44721c8349a3bb4ea97f..3767bf1dee624a3c36b866c2578cc1ae925ce5f6 100644 (file)
--- a/ChangeLog
+++ b/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>
 
        * Versions.def: Add GLIBC_2.18.
index 4db52ceb2b4f2b38856a4865b44f1ef0e608331a..ae0a643ac0a5b21c4042641394ccc236b476d44f 100644 (file)
@@ -137,13 +137,7 @@ static struct argp argp =
 
 
 /* Wrapper functions with error checking for standard 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__;
+#include <programs/xmalloc.h>
 
 /* Prototypes for local functions.  */
 static void error_print (void);
index b09252d39cb04000632b012e748ca8a1c6deedef..d9388a19c23cd0e6c035b0c2110585cf3c9a131e 100644 (file)
@@ -43,10 +43,7 @@ extern char *program_invocation_short_name;
 #define PACKAGE _libc_intl_domainname
 
 /* External functions.  */
-extern void *xmalloc (size_t n)
-  __attribute_malloc__ __attribute_alloc_size (1);
-extern void *xrealloc (void *o, size_t n)
-  __attribute_malloc__ __attribute_alloc_size (2);
+#include <programs/xmalloc.h>
 
 /* Name and version of program.  */
 static void print_version (FILE *stream, struct argp_state *state);
index 7a4067b8111250572aa10ac0aab14cf8fe2d1645..b1a06109767071ccf4c69592dcea8c1cda2258ea 100644 (file)
 
 
 /* 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);
+#include <programs/xmalloc.h>
 
 
 struct convtable
index 318c917e9202255149974ca2a97b08ccf1864d75..677620b963166592127707a4af9caf79f6c1f995 100644 (file)
@@ -247,12 +247,7 @@ static struct
 static const char gconv_module_ext[] = MODULE_EXT;
 
 
-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);
+#include <programs/xmalloc.h>
 
 
 /* C string table handling.  */
index 7160ac88a5061c3b68afaaae0101c077814a79f9..c62553e2e0cf71735bf4a8ca97e5146cec734689 100644 (file)
@@ -65,8 +65,7 @@ struct Strtab
 static size_t ps;
 
 
-extern void *xmalloc (size_t n)
-  __attribute_malloc__ __attribute_alloc_size (1);
+#include <programs/xmalloc.h>
 
 /* Prototypes for our functions that are used from iconvconfig.c.  If
    you change these, change also iconvconfig.c.  */
diff --git a/include/programs/xmalloc.h b/include/programs/xmalloc.h
new file mode 100644 (file)
index 0000000..7f3aba5
--- /dev/null
@@ -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 */
index 13e5234954190a323091b80146dadca8a41c91bb..8dc528c115665c048ab76305e1290f41fc58ee17 100644 (file)
 #include "localeinfo.h"
 #include "charmap-dir.h"
 #include "../locarchive.h"
-
-extern void *xmalloc (size_t n)
-  __attribute_malloc__ __attribute_alloc_size (1);
-extern char *xstrdup (const char *) __attribute_malloc__;
+#include <programs/xmalloc.h>
 
 #define ARCHIVE_NAME LOCALEDIR "/locale-archive"
 
index 7ca65c66390daaf6eef556a0237677caa4a335cd..e010c72983e0ca3c8a1c46ecdac6b4c261ab9f19 100644 (file)
@@ -120,13 +120,7 @@ extern const char *alias_file;
 
 
 /* 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__;
+#include <programs/xmalloc.h>
 
 
 /* Wrapper to switch LC_CTYPE back to the locale specified in the
index 530ba724e8732093bc92bdfccce507a770176dfb..d65b6fb3f0aad5052c9f9d467697646feacd533a 100644 (file)
 #define hashval_t uint32_t
 #include "hashval.h"
 
-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);
+#include <programs/xmalloc.h>
 
 typedef struct hash_entry
 {
index 46d0433286118982600298bf28e53db1e8d8fbd8..cbd402a9583a3be82f05f4752b2b99e95f960b9c 100644 (file)
@@ -200,12 +200,7 @@ extern gid_t old_gid;
 /* Prototypes for global functions.  */
 
 /* Wrapper functions with error checking for standard 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);
+#include <programs/xmalloc.h>
 
 /* nscd.c */
 extern void termination_handler (int signum) __attribute__ ((__noreturn__));
index d4a19b3597c79d2db891488edc8733b7c11dfa55..13bd8461d4c788fac39a6791efba40d7224cb6ca 100644 (file)
@@ -173,10 +173,7 @@ static void reset_file_creation_context (void);
 
 
 /* External 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);
+#include <programs/xmalloc.h>
 
 
 int
index 91190aa0cd42e0baa9580626b1da33cf4b873a1f..ca3f0e430f95bf6a28f73ca1123bfc4998797c98 100644 (file)
@@ -84,12 +84,6 @@ extern int opt_verbose;
 extern int opt_format;
 
 /* 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__;
+#include <programs/xmalloc.h>
 
 #endif /* ! _LDCONFIG_H  */