+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.
/* 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
/* 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,
/* 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
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)