From 9d7bae0b6ab66e7e0cff8871e65ecddb55513d6b Mon Sep 17 00:00:00 2001
From: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Wed, 24 Feb 1999 14:55:51 -0300
Subject: better instrumentation for internal debugging

---
 lmem.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

(limited to 'lmem.c')

diff --git a/lmem.c b/lmem.c
index ccf1a4a8..a1379f24 100644
--- a/lmem.c
+++ b/lmem.c
@@ -1,5 +1,5 @@
 /*
-** $Id: lmem.c,v 1.8 1999/01/22 17:28:00 roberto Exp roberto $
+** $Id: lmem.c,v 1.9 1999/01/22 18:08:57 roberto Exp roberto $
 ** Interface to Memory Manager
 ** See Copyright Notice in lua.h
 */
@@ -24,6 +24,8 @@
 
 
 
+#ifndef DEBUG
+
 int luaM_growaux (void **block, unsigned long nelems, int size,
                        char *errormsg, unsigned long limit) {
   if (nelems >= limit)
@@ -36,9 +38,6 @@ int luaM_growaux (void **block, unsigned long nelems, int size,
 }
 
 
-
-#ifndef DEBUG
-
 /*
 ** generic allocation routine.
 */
@@ -64,6 +63,18 @@ void *luaM_realloc (void *block, unsigned long size) {
 #include <string.h>
 
 
+int luaM_growaux (void **block, unsigned long nelems, int size,
+                       char *errormsg, unsigned long limit) {
+  if (nelems >= limit)
+    lua_error(errormsg);
+  nelems = nelems+1;
+  if (nelems > limit)
+    nelems = limit;
+  *block = luaM_realloc(*block, nelems*size);
+  return (int)nelems;
+}
+
+
 #define HEADER	(sizeof(double))
 
 #define MARK    55
-- 
cgit v1.2.3-55-g6feb