chiark / gitweb /
Commit as 2.1.0.
[mLib] / alloc.c
diff --git a/alloc.c b/alloc.c
index d425e97573b9f9c718add5cb9a0ccaf35b9e7dd7..c04b2203f3dab122716818a3cffc0fb9aaad4972 100644 (file)
--- a/alloc.c
+++ b/alloc.c
@@ -1,13 +1,13 @@
 /* -*-c-*-
  *
- * $Id: alloc.c,v 1.4 2000/06/17 10:35:51 mdw Exp $
+ * $Id: alloc.c,v 1.6 2004/04/08 01:36:11 mdw Exp $
  *
  * Memory allocation functions
  *
  * (c) 1998 Straylight/Edgeware
  */
 
-/*----- Licensing notice --------------------------------------------------* 
+/*----- Licensing notice --------------------------------------------------*
  *
  * This file is part of the mLib utilities library.
  *
  * it under the terms of the GNU Library General Public License as
  * published by the Free Software Foundation; either version 2 of the
  * License, or (at your option) any later version.
- * 
+ *
  * mLib 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 Library General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU Library General Public
  * License along with mLib; if not, write to the Free
  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  * MA 02111-1307, USA.
  */
 
-/*----- Revision history --------------------------------------------------*
- *
- * $Log: alloc.c,v $
- * Revision 1.4  2000/06/17 10:35:51  mdw
- * Major overhaul for arena support.
- *
- * Revision 1.3  1999/05/06 19:51:35  mdw
- * Reformatted the LGPL notice a little bit.
- *
- * Revision 1.2  1999/05/05 18:50:31  mdw
- * Change licensing conditions to LGPL.
- *
- * Revision 1.1.1.1  1998/06/17 23:44:42  mdw
- * Initial version of mLib
- *
- */
-
 /*----- Header files ------------------------------------------------------*/
 
 /* --- ANSI headers --- */
@@ -104,6 +87,7 @@ char *x_strdup(arena *a, const char *s)
  * Arguments:  @arena *a@ = pointer to underlying arena
  *             @void *p@ = pointer to a block of memory
  *             @size_t sz@ = new size desired for the block
+ *             @size_t osz@ = size of the old block
  *
  * Returns:    Pointer to the resized memory block (which is almost
  *             certainly not in the same place any more).
@@ -112,9 +96,9 @@ char *x_strdup(arena *a, const char *s)
  *             exception @EXC_NOMEM@ is thrown.
  */
 
-void *x_realloc(arena *a, void *p, size_t sz)
+void *x_realloc(arena *a, void *p, size_t sz, size_t osz)
 {
-  p = A_REALLOC(a, p, sz);
+  p = A_REALLOC(a, p, sz, osz);
   if (!p)
     THROW(EXC_NOMEM);
   return (p);
@@ -163,6 +147,7 @@ char *(xstrdup)(const char *s) { return xstrdup(s); }
  *
  * Arguments:  @void *p@ = pointer to a block of memory
  *             @size_t sz@ = new size desired for the block
+ *             @size_t osz@ = size of the old block
  *
  * Returns:    Pointer to the resized memory block (which is almost
  *             certainly not in the same place any more).
@@ -171,7 +156,8 @@ char *(xstrdup)(const char *s) { return xstrdup(s); }
  *             exception @EXC_NOMEM@ is thrown.
  */
 
-void *(xrealloc)(void *p, size_t sz) { return xrealloc(p, sz); }
+void *(xrealloc)(void *p, size_t sz, size_t osz)
+{ return xrealloc(p, sz, osz); }
 
 /* --- @xfree@ --- *
  *