From e0ebc1eba1e0844b07f50bb167e3497fa3048b62 Mon Sep 17 00:00:00 2001 From: stanton Date: Thu, 4 Mar 1999 00:58:46 +0000 Subject: * unix/Makefile.in: * generic/tclAlloc.c: Changed so stub versions of TclpAlloc, etc. are generated when TCL_MEM_DEBUG is not defined. --- generic/tclAlloc.c | 92 +++++++++++++++++++++++++++++++++++++++++++++--------- unix/Makefile.in | 8 +++-- 2 files changed, 84 insertions(+), 16 deletions(-) diff --git a/generic/tclAlloc.c b/generic/tclAlloc.c index 6111a7c..5744302 100644 --- a/generic/tclAlloc.c +++ b/generic/tclAlloc.c @@ -14,12 +14,14 @@ * 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.3 1999/01/06 21:08:51 stanton Exp $ + * RCS: @(#) $Id: tclAlloc.c,v 1.3.4.1 1999/03/04 00:58:46 stanton Exp $ */ #include "tclInt.h" #include "tclPort.h" +#ifndef USE_NATIVEMALLOC + #ifdef TCL_DEBUG # define DEBUG /* #define MSTATS */ @@ -125,9 +127,6 @@ 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; @@ -206,7 +205,6 @@ TclpAlloc( *(unsigned short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC; #endif return ((char *)(op + 1)); -#endif /* USE_NATIVEMALLOC */ } /* @@ -283,10 +281,6 @@ void TclpFree( char *cp) /* Pointer to memory to free. */ { -#ifdef USE_NATIVEMALLOC - free(cp); - return; -#else register long size; register union overhead *op; @@ -318,7 +312,6 @@ TclpFree( #ifdef MSTATS nmalloc[size]--; #endif -#endif /* USE_NATIVEMALLOC */ } /* @@ -342,9 +335,6 @@ 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; @@ -419,7 +409,6 @@ TclpRealloc( *(unsigned short *)((caddr_t)(op + 1) + op->ov_size) = RMAGIC; #endif return(cp); -#endif /* USE_NATIVEMALLOC */ } /* @@ -468,3 +457,78 @@ mstats( } #endif +#else /* USE_NATIVEMALLOC */ + + +/* + *---------------------------------------------------------------------- + * + * TclpAlloc -- + * + * Allocate more memory. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +TclpAlloc( + unsigned int nbytes) /* Number of bytes to allocate. */ +{ + return (char*) malloc(nbytes); +} + +/* + *---------------------------------------------------------------------- + * + * TclpFree -- + * + * Free memory. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +void +TclpFree( + char *cp) /* Pointer to memory to free. */ +{ + free(cp); + return; +} + +/* + *---------------------------------------------------------------------- + * + * TclpRealloc -- + * + * Reallocate memory. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +TclpRealloc( + char *cp, /* Pointer to alloced block. */ + unsigned int nbytes) /* New size of memory. */ +{ + return (char*) realloc(cp, nbytes); +} + +#endif /* USE_NATIVEMALLOC */ diff --git a/unix/Makefile.in b/unix/Makefile.in index 0ea466a..d8ebc40 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -5,7 +5,7 @@ # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.17.4.1 1999/03/03 00:38:45 stanton Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.17.4.2 1999/03/04 00:58:46 stanton Exp $ # Current Tcl version; used in various names. @@ -270,6 +270,7 @@ GENERIC_HDRS = \ GENERIC_SRCS = \ $(GENERIC_DIR)/regexp.c \ + $(GENERIC_DIR)/tclAlloc.c \ $(GENERIC_DIR)/tclAsync.c \ $(GENERIC_DIR)/tclBasic.c \ $(GENERIC_DIR)/tclBinary.c \ @@ -435,7 +436,7 @@ topDirName: gendate: yacc -l $(GENERIC_DIR)/tclGetDate.y sed -e 's/yy/TclDate/g' -e '/^#include /d' \ - -e 's/SCCSID/RCS: @(#) $Id: Makefile.in,v 1.17.4.1 1999/03/03 00:38:45 stanton Exp $' + -e 's/SCCSID/RCS: @(#) $Id: Makefile.in,v 1.17.4.2 1999/03/04 00:58:46 stanton Exp $' -e '/#ifdef __STDC__/,/#endif/d' -e '/TclDateerrlab:/d' \ -e '/TclDatenewstate:/d' -e '/#pragma/d' \ $(GENERIC_DIR)/tclDate.c @@ -643,6 +644,9 @@ regexp.o: $(GENERIC_DIR)/regexp.c tclAppInit.o: $(UNIX_DIR)/tclAppInit.c $(CC) -c $(CC_SWITCHES) $(UNIX_DIR)/tclAppInit.c +tclAlloc.o: $(GENERIC_DIR)/tclAlloc.c + $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclAlloc.c + tclAsync.o: $(GENERIC_DIR)/tclAsync.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclAsync.c -- cgit v0.12