]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Implement the xzalloc function.
authorBruno Haible <bruno@clisp.org>
Thu, 27 Jul 2006 12:06:09 +0000 (12:06 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:13:41 +0000 (12:13 +0200)
gettext-tools/lib/ChangeLog
gettext-tools/lib/xalloc.h
gettext-tools/lib/xmalloc.c

index b108fe868f2b0ef09de067ee11b5d6b60657671f..16db26f8a2ba6132a7cce6b00531c7c59c623bc7 100644 (file)
@@ -1,3 +1,8 @@
+2006-07-18  Bruno Haible  <bruno@clisp.org>
+
+       * xalloc.h (xzalloc): New declaration.
+       * xmalloc.c (xzalloc): New function.
+
 2006-07-25  Bruno Haible  <bruno@clisp.org>
 
        * Makefile.msvc: Remove file.
index 06779d9e9935f1bd0129fae2f9e522d4174c1b54..de230ebb8fc46cd1898ba0dbdc5ce14772a2c972 100644 (file)
@@ -1,5 +1,5 @@
 /* malloc with out of memory checking.
-   Copyright (C) 2001-2004 Free Software Foundation, Inc.
+   Copyright (C) 2001-2004, 2006 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software; you can redistribute it and/or modify
@@ -32,7 +32,12 @@ extern "C" {
 /* Allocate SIZE bytes of memory dynamically, with error checking.  */
 extern void *xmalloc (size_t size);
 
-/* Allocate memory for NMEMB elements of SIZE bytes, with error checking.  */
+/* Allocate SIZE bytes of memory dynamically, with error checking,
+   and zero it.  */
+extern void *xzalloc (size_t size);
+
+/* Allocate memory for NMEMB elements of SIZE bytes, with error checking,
+   and zero it.  */
 extern void *xcalloc (size_t nmemb, size_t size);
 
 /* Change the size of an allocated block of memory PTR to SIZE bytes,
index 886dd7d52e29930bd3a95670a9cce03375969ebb..98550b56f8c3afa59a721d6b2dae1521fd2cff16 100644 (file)
@@ -1,5 +1,5 @@
 /* xmalloc.c -- malloc with out of memory checking
-   Copyright (C) 1990-1996, 2000-2003, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1990-1996, 2000-2003, 2005-2006 Free Software Foundation, Inc.
 
    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
@@ -71,7 +71,21 @@ xmalloc (size_t n)
   return p;
 }
 
-/* Allocate memory for N elements of S bytes, with error checking.  */
+/* Allocate SIZE bytes of memory dynamically, with error checking,
+   and zero it.  */
+
+void *
+xzalloc (size_t size)
+{
+  void *p;
+
+  p = xmalloc (size);
+  memset (p, 0, size);
+  return p;
+}
+
+/* Allocate memory for N elements of S bytes, with error checking,
+   and zero it.  */
 
 void *
 xcalloc (size_t n, size_t s)