This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.15-73-gec09c1c


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  ec09c1c410d40386ec3e5d2d82fc5c378b4b2681 (commit)
      from  aebae0537dcb408100b88c6b7647a7e858c43237 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=ec09c1c410d40386ec3e5d2d82fc5c378b4b2681

commit ec09c1c410d40386ec3e5d2d82fc5c378b4b2681
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Sun Jan 8 21:19:43 2012 -0500

    Optimize xmalloc, xcalloc, xrealloc, and xstrdup
    
    Add alloc_size attribute and apply consistently the malloc attribute
    to xmalloc, xcalloc, xrealloc, and xstrdup.

diff --git a/ChangeLog b/ChangeLog
index 0726cd4..a08838c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2012-01-08  Ulrich Drepper  <drepper@gmail.com>
+
+	* include/sys/cdefs.h: Define __attribute_alloc_size.
+	* catgets/gencat.c: Add alloc_size attribute and apply consistently
+	the malloc attribute to xmalloc, xcalloc, xrealloc, and xstrdup.
+	* 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.
+	* locale/programs/localedef.c: Remove xmalloc prototype.
+	* nscd/mem.c: Remove xmalloc and xcalloc prototypes.
+
 2012-01-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
 
 	* stdio-common/vfscanf.c (_IO_vfscanf_internal): Use alloca when
diff --git a/catgets/gencat.c b/catgets/gencat.c
index c8cabb9..a915543 100644
--- a/catgets/gencat.c
+++ b/catgets/gencat.c
@@ -138,10 +138,13 @@ static struct argp argp =
 
 
 /* Wrapper functions with error checking for standard functions.  */
-extern void *xmalloc (size_t n);
-extern void *xcalloc (size_t n, size_t s);
-extern void *xrealloc (void *o, size_t n);
-extern char *xstrdup (const char *);
+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__;
 
 /* Prototypes for local functions.  */
 static void error_print (void);
diff --git a/elf/pldd.c b/elf/pldd.c
index 255326e..51a3f44 100644
--- a/elf/pldd.c
+++ b/elf/pldd.c
@@ -44,8 +44,10 @@ extern char *program_invocation_short_name;
 #define PACKAGE _libc_intl_domainname
 
 /* External functions.  */
-extern void *xmalloc (size_t n);
-extern void *xrealloc (void *p, size_t n);
+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);
 
 /* Name and version of program.  */
 static void print_version (FILE *stream, struct argp_state *state);
diff --git a/iconv/iconv_charmap.c b/iconv/iconv_charmap.c
index d128111..09bfa92 100644
--- a/iconv/iconv_charmap.c
+++ b/iconv/iconv_charmap.c
@@ -1,5 +1,5 @@
 /* Convert using charmaps and possibly iconv().
-   Copyright (C) 2001, 2005, 2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2005, 2006, 2008, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
 
@@ -33,8 +33,10 @@
 
 
 /* Prototypes for a few program-wide used functions.  */
-extern void *xmalloc (size_t __n);
-extern void *xcalloc (size_t __n, size_t __s);
+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);
 
 
 struct convtable
diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c
index afcea94..9738ed8 100644
--- a/iconv/iconvconfig.c
+++ b/iconv/iconvconfig.c
@@ -248,9 +248,12 @@ static struct
 static const char gconv_module_ext[] = MODULE_EXT;
 
 
-extern void *xmalloc (size_t n) __attribute_malloc__;
-extern void *xcalloc (size_t n, size_t m) __attribute_malloc__;
-extern void *xrealloc (void *p, size_t n);
+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);
 
 
 /* C string table handling.  */
diff --git a/iconv/strtab.c b/iconv/strtab.c
index 4a8f29a..37b9077 100644
--- a/iconv/strtab.c
+++ b/iconv/strtab.c
@@ -1,5 +1,5 @@
 /* C string table handling.
-   Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2005, 2012 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@redhat.com>, 2000.
 
    This program is free software; you can redistribute it and/or modify
@@ -66,7 +66,8 @@ struct Strtab
 static size_t ps;
 
 
-extern void *xmalloc (size_t n) __attribute_malloc__;
+extern void *xmalloc (size_t n)
+  __attribute_malloc__ __attribute_alloc_size (1);
 
 /* Prototypes for our functions that are used from iconvconfig.c.  If
    you change these, change also iconvconfig.c.  */
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
index cd0750b..a2bdf20 100644
--- a/include/sys/cdefs.h
+++ b/include/sys/cdefs.h
@@ -12,4 +12,11 @@ extern void __chk_fail (void) __attribute__ ((__noreturn__));
 libc_hidden_proto (__chk_fail)
 rtld_hidden_proto (__chk_fail)
 
+
+#if __GNUC_PREREQ (4,3)
+# define __attribute_alloc_size(...) __attribute__ ((alloc_size (__VA_ARGS__)))
+#else
+# define __attribute_alloc_size(...)
+#endif
+
 #endif
diff --git a/locale/programs/locale.c b/locale/programs/locale.c
index 579094d..2cd4be8 100644
--- a/locale/programs/locale.c
+++ b/locale/programs/locale.c
@@ -44,8 +44,9 @@
 #include "charmap-dir.h"
 #include "../locarchive.h"
 
-extern void *xmalloc (size_t __n);
-extern char *xstrdup (const char *__str);
+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"
 
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
index aa59444..75905f9 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
@@ -169,9 +169,6 @@ static struct argp argp =
 };
 
 
-/* Prototypes for global functions.  */
-extern void *xmalloc (size_t __n);
-
 /* Prototypes for local functions.  */
 static void error_print (void);
 static const char *construct_output_path (char *path);
diff --git a/locale/programs/localedef.h b/locale/programs/localedef.h
index bdff9e6..ac1cae5 100644
--- a/locale/programs/localedef.h
+++ b/locale/programs/localedef.h
@@ -1,5 +1,5 @@
 /* General definitions for localedef(1).
-   Copyright (C) 1998,1999,2000,2001,2002,2005 Free Software Foundation, Inc.
+   Copyright (C) 1998-2002,2005,2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -121,10 +121,13 @@ extern const char *alias_file;
 
 
 /* Prototypes for a few program-wide used functions.  */
-extern void *xmalloc (size_t __n);
-extern void *xcalloc (size_t __n, size_t __size);
-extern void *xrealloc (void *__p, size_t __n);
-extern char *xstrdup (const char *__str);
+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__;
 
 
 /* Wrapper to switch LC_CTYPE back to the locale specified in the
diff --git a/locale/programs/simple-hash.c b/locale/programs/simple-hash.c
index b9cc237..573f7e4 100644
--- a/locale/programs/simple-hash.c
+++ b/locale/programs/simple-hash.c
@@ -1,5 +1,5 @@
 /* Implement simple hashing table with string based keys.
-   Copyright (C) 1994-1997,2000,2001,2002,2005 Free Software Foundation, Inc.
+   Copyright (C) 1994-1997,2000-2002,2005,2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, October 1994.
 
@@ -53,8 +53,10 @@
 #define hashval_t uint32_t
 #include "hashval.h"
 
-extern void *xmalloc (size_t __n);
-extern void *xcalloc (size_t __n, size_t __m);
+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);
 
 typedef struct hash_entry
 {
diff --git a/nscd/mem.c b/nscd/mem.c
index fcea6db..8ba2ef6 100644
--- a/nscd/mem.c
+++ b/nscd/mem.c
@@ -1,5 +1,5 @@
 /* Cache memory handling.
-   Copyright (C) 2004, 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2004-2006, 2008, 2009, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
 
@@ -35,11 +35,6 @@
 #include "nscd.h"
 
 
-/* Wrapper functions with error checking for standard functions.  */
-extern void *xmalloc (size_t n);
-extern void *xcalloc (size_t n, size_t s);
-
-
 static int
 sort_he (const void *p1, const void *p2)
 {
diff --git a/nscd/nscd.h b/nscd/nscd.h
index fdaf01b..9ac4379 100644
--- a/nscd/nscd.h
+++ b/nscd/nscd.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998-2001, 2003-2009, 2011 Free Software Foundation, Inc.
+/* Copyright (c) 1998-2001, 2003-2009, 2011, 2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
 
@@ -201,9 +201,12 @@ extern gid_t old_gid;
 /* Prototypes for global functions.  */
 
 /* Wrapper functions with error checking for standard functions.  */
-extern void *xmalloc (size_t n);
-extern void *xcalloc (size_t n, size_t s);
-extern void *xrealloc (void *o, size_t n);
+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);
 
 /* nscd.c */
 extern void termination_handler (int signum) __attribute__ ((__noreturn__));
diff --git a/nss/makedb.c b/nss/makedb.c
index 52d4ae3..e9b6af0 100644
--- a/nss/makedb.c
+++ b/nss/makedb.c
@@ -167,8 +167,10 @@ static void reset_file_creation_context (void);
 
 
 /* External functions.  */
-extern void *xmalloc (size_t n) __attribute_malloc__;
-extern void *xcalloc (size_t n, size_t m) __attribute_malloc__;
+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);
 
 
 int
diff --git a/sysdeps/generic/ldconfig.h b/sysdeps/generic/ldconfig.h
index fadd5ec..2381d9e 100644
--- a/sysdeps/generic/ldconfig.h
+++ b/sysdeps/generic/ldconfig.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2002, 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2000,2002,2003,2007,2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Andreas Jaeger <aj@suse.de>, 1999.
 
@@ -81,9 +81,12 @@ extern int opt_verbose;
 extern int opt_format;
 
 /* Prototypes for a few program-wide used functions.  */
-extern void *xmalloc (size_t __n);
-extern void *xcalloc (size_t __n, size_t __size);
-extern void *xrealloc (void *__p, size_t __n);
-extern char *xstrdup (const char *__str);
+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 /* ! _LDCONFIG_H  */

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                     |   18 ++++++++++++++++++
 catgets/gencat.c              |   11 +++++++----
 elf/pldd.c                    |    6 ++++--
 iconv/iconv_charmap.c         |    8 +++++---
 iconv/iconvconfig.c           |    9 ++++++---
 iconv/strtab.c                |    5 +++--
 include/sys/cdefs.h           |    7 +++++++
 locale/programs/locale.c      |    5 +++--
 locale/programs/localedef.c   |    3 ---
 locale/programs/localedef.h   |   13 ++++++++-----
 locale/programs/simple-hash.c |    8 +++++---
 nscd/mem.c                    |    7 +------
 nscd/nscd.h                   |   11 +++++++----
 nss/makedb.c                  |    6 ++++--
 sysdeps/generic/ldconfig.h    |   13 ++++++++-----
 15 files changed, 86 insertions(+), 44 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]