From cde815f4573a6844909ab0e34c2d95fd1044f99b Mon Sep 17 00:00:00 2001
From: Martin Stjernholm <mast@lysator.liu.se>
Date: Thu, 30 Sep 2004 16:00:15 +0200
Subject: [PATCH] Wrap the allocation calls for better dmalloc info (just like
 it already is for mappings).

Rev: src/array.c:1.173
Rev: src/array.h:1.66
Rev: src/multiset.c:1.90
Rev: src/multiset.h:1.39
---
 src/array.c    |  6 +++---
 src/array.h    |  8 ++++++--
 src/multiset.c |  8 ++++----
 src/multiset.h | 12 ++++++++----
 4 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/src/array.c b/src/array.c
index b00d344718..314323866f 100644
--- a/src/array.c
+++ b/src/array.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: array.c,v 1.172 2004/09/27 21:47:49 nilsson Exp $
+|| $Id: array.c,v 1.173 2004/09/30 14:00:13 mast Exp $
 */
 
 #include "global.h"
@@ -69,8 +69,8 @@ PMOD_EXPORT void dont_accept_unfinished_type_fields (void *orig)
  * NOTE: the new array has zero references
  */
 
-PMOD_EXPORT struct array *low_allocate_array(ptrdiff_t size,
-					     ptrdiff_t extra_space)
+PMOD_EXPORT struct array *real_allocate_array(ptrdiff_t size,
+					      ptrdiff_t extra_space)
 {
   struct array *v;
   ptrdiff_t e;
diff --git a/src/array.h b/src/array.h
index 00dec73e84..76a1a54c45 100644
--- a/src/array.h
+++ b/src/array.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: array.h,v 1.65 2004/09/28 23:58:26 mast Exp $
+|| $Id: array.h,v 1.66 2004/09/30 14:00:14 mast Exp $
 */
 
 #ifndef ARRAY_H
@@ -87,8 +87,12 @@ typedef int (*short_cmpfun)(union anything *, union anything *);
 typedef short_cmpfun (*cmpfun_getter)(TYPE_T);
 
 
+#define low_allocate_array(size, extra_space)				\
+  dmalloc_touch (struct array *,					\
+		 real_allocate_array ((size), (extra_space)))
+
 /* Prototypes begin here */
-PMOD_EXPORT struct array *low_allocate_array(ptrdiff_t size, ptrdiff_t extra_space);
+PMOD_EXPORT struct array *real_allocate_array(ptrdiff_t size, ptrdiff_t extra_space);
 PMOD_EXPORT void really_free_array(struct array *v);
 PMOD_EXPORT void do_free_array(struct array *a);
 PMOD_EXPORT struct array *array_set_flags(struct array *a, int flags);
diff --git a/src/multiset.c b/src/multiset.c
index d8cb6a1779..8418120aa5 100644
--- a/src/multiset.c
+++ b/src/multiset.c
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: multiset.c,v 1.89 2004/09/30 02:33:06 nilsson Exp $
+|| $Id: multiset.c,v 1.90 2004/09/30 14:00:15 mast Exp $
 */
 
 #include "global.h"
@@ -839,9 +839,9 @@ PMOD_EXPORT INT32 multiset_sizeof (struct multiset *l)
   return size;
 }
 
-PMOD_EXPORT struct multiset *allocate_multiset (int allocsize,
-						int flags,
-						struct svalue *cmp_less)
+PMOD_EXPORT struct multiset *real_allocate_multiset (int allocsize,
+						     int flags,
+						     struct svalue *cmp_less)
 {
   struct multiset *l = alloc_multiset();
 
diff --git a/src/multiset.h b/src/multiset.h
index cdcd924828..53eca44fd0 100644
--- a/src/multiset.h
+++ b/src/multiset.h
@@ -2,7 +2,7 @@
 || This file is part of Pike. For copyright information see COPYRIGHT.
 || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
 || for more information.
-|| $Id: multiset.h,v 1.38 2004/09/28 23:58:26 mast Exp $
+|| $Id: multiset.h,v 1.39 2004/09/30 14:00:15 mast Exp $
 */
 
 #ifndef MULTISET_H
@@ -358,9 +358,13 @@ PMOD_EXPORT int msnode_is_deleted (struct multiset *l, ptrdiff_t nodepos);
 #define push_multiset_value(L, NODEPOS)					\
   push_svalue (get_multiset_value (L, NODEPOS))
 
-PMOD_EXPORT struct multiset *allocate_multiset (int allocsize,
-						int flags,
-						struct svalue *cmp_less);
+#define allocate_multiset(allocsize, flags, cmp_less)			\
+  dmalloc_touch (struct multiset *,					\
+		 real_allocate_multiset ((allocsize), (flags), (cmp_less)))
+
+PMOD_EXPORT struct multiset *real_allocate_multiset (int allocsize,
+						     int flags,
+						     struct svalue *cmp_less);
 PMOD_EXPORT void do_free_multiset (struct multiset *l);
 void multiset_fix_type_field (struct multiset *l);
 PMOD_EXPORT void multiset_set_flags (struct multiset *l, int flags);
-- 
GitLab