summaryrefslogtreecommitdiffstats
path: root/generic/tclAlloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclAlloc.c')
-rw-r--r--generic/tclAlloc.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c
index 7a693ac..6111a7c 100644
--- a/generic/tclAlloc.c
+++ b/generic/tclAlloc.c
@@ -14,7 +14,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclAlloc.c,v 1.2 1998/09/14 18:39:57 stanton Exp $
+ * RCS: @(#) $Id: tclAlloc.c,v 1.3 1999/01/06 21:08:51 stanton Exp $
*/
#include "tclInt.h"
@@ -125,6 +125,9 @@ char *
TclpAlloc(
unsigned int nbytes) /* Number of bytes to allocate. */
{
+#ifdef USE_NATIVEMALLOC
+ return (char*) malloc(nbytes);
+#else
register union overhead *op;
register long bucket;
register unsigned amt;
@@ -203,6 +206,7 @@ TclpAlloc(
*(unsigned short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC;
#endif
return ((char *)(op + 1));
+#endif /* USE_NATIVEMALLOC */
}
/*
@@ -279,6 +283,10 @@ void
TclpFree(
char *cp) /* Pointer to memory to free. */
{
+#ifdef USE_NATIVEMALLOC
+ free(cp);
+ return;
+#else
register long size;
register union overhead *op;
@@ -310,6 +318,7 @@ TclpFree(
#ifdef MSTATS
nmalloc[size]--;
#endif
+#endif /* USE_NATIVEMALLOC */
}
/*
@@ -333,6 +342,9 @@ TclpRealloc(
char *cp, /* Pointer to alloced block. */
unsigned int nbytes) /* New size of memory. */
{
+#ifdef USE_NATIVEMALLOC
+ return (char*) realloc(cp, nbytes);
+#else
int i;
union overhead *op;
int expensive;
@@ -407,6 +419,7 @@ TclpRealloc(
*(unsigned short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC;
#endif
return(cp);
+#endif /* USE_NATIVEMALLOC */
}
/*
@@ -454,3 +467,4 @@ mstats(
MAXMALLOC, nmalloc[NBUCKETS]);
}
#endif
+