From: Perl 5 Porters Date: Tue, 20 Aug 1996 10:38:54 +0000 (+0000) Subject: perl 5.003_03: handy.h X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=44ae4f4f163d5d4bc77d7abbfbe6ab893202d9d4;p=p5sagit%2Fp5-mst-13.2.git perl 5.003_03: handy.h Change safe*alloc functions to have prototypes that match the system's malloc and free types. That is, use Malloc_t instead of char *, and Free_t instead of void. This is necessary so . . . Safefree cast matches type of free() whether it's perl's malloc/free or the system's malloc/free. --- diff --git a/handy.h b/handy.h index b1fca33..ee31bf0 100644 --- a/handy.h +++ b/handy.h @@ -143,40 +143,40 @@ typedef U16 line_t; #ifndef lint #ifndef LEAKTEST #ifndef safemalloc -char *safemalloc _((MEM_SIZE)); -char *saferealloc _((char *, MEM_SIZE)); -void safefree _((char *)); -char *safecalloc _((MEM_SIZE, MEM_SIZE)); +Malloc_t safemalloc _((MEM_SIZE)); +Malloc_t saferealloc _((Malloc_t, MEM_SIZE)); +Free_t safefree _((Malloc_t)); +Malloc_t safecalloc _((MEM_SIZE, MEM_SIZE)); #endif #ifndef MSDOS #define New(x,v,n,t) (v = (t*)safemalloc((MEM_SIZE)((n) * sizeof(t)))) #define Newc(x,v,n,t,c) (v = (c*)safemalloc((MEM_SIZE)((n) * sizeof(t)))) #define Newz(x,v,n,t) (v = (t*)safemalloc((MEM_SIZE)((n) * sizeof(t)))), \ memzero((char*)(v), (n) * sizeof(t)) -#define Renew(v,n,t) (v = (t*)saferealloc((char*)(v),(MEM_SIZE)((n)*sizeof(t)))) -#define Renewc(v,n,t,c) (v = (c*)saferealloc((char*)(v),(MEM_SIZE)((n)*sizeof(t)))) +#define Renew(v,n,t) (v = (t*)saferealloc((Malloc_t)(v),(MEM_SIZE)((n)*sizeof(t)))) +#define Renewc(v,n,t,c) (v = (c*)saferealloc((Malloc_t)(v),(MEM_SIZE)((n)*sizeof(t)))) #else #define New(x,v,n,t) (v = (t*)safemalloc(((unsigned long)(n) * sizeof(t)))) #define Newc(x,v,n,t,c) (v = (c*)safemalloc(((unsigned long)(n) * sizeof(t)))) #define Newz(x,v,n,t) (v = (t*)safemalloc(((unsigned long)(n) * sizeof(t)))), \ memzero((char*)(v), (n) * sizeof(t)) -#define Renew(v,n,t) (v = (t*)saferealloc((char*)(v),((unsigned long)(n)*sizeof(t)))) -#define Renewc(v,n,t,c) (v = (c*)saferealloc((char*)(v),((unsigned long)(n)*sizeof(t)))) +#define Renew(v,n,t) (v = (t*)saferealloc((Malloc_t)(v),((unsigned long)(n)*sizeof(t)))) +#define Renewc(v,n,t,c) (v = (c*)saferealloc((Malloc_t)(v),((unsigned long)(n)*sizeof(t)))) #endif /* MSDOS */ -#define Safefree(d) safefree((char*)d) +#define Safefree(d) safefree((Malloc_t)(d)) #define NEWSV(x,len) newSV(len) #else /* LEAKTEST */ -char *safexmalloc(); -char *safexrealloc(); -void safexfree(); -char *safexcalloc(); +Malloc_t safexmalloc(); +Malloc_t safexrealloc(); +Free_t safexfree(); +Malloc_t safexcalloc(); #define New(x,v,n,t) (v = (t*)safexmalloc(x,(MEM_SIZE)((n) * sizeof(t)))) #define Newc(x,v,n,t,c) (v = (c*)safexmalloc(x,(MEM_SIZE)((n) * sizeof(t)))) #define Newz(x,v,n,t) (v = (t*)safexmalloc(x,(MEM_SIZE)((n) * sizeof(t)))), \ memzero((char*)(v), (n) * sizeof(t)) -#define Renew(v,n,t) (v = (t*)safexrealloc((char*)(v),(MEM_SIZE)((n)*sizeof(t)))) -#define Renewc(v,n,t,c) (v = (c*)safexrealloc((char*)(v),(MEM_SIZE)((n)*sizeof(t)))) -#define Safefree(d) safexfree((char*)d) +#define Renew(v,n,t) (v = (t*)safexrealloc((Malloc_t)(v),(MEM_SIZE)((n)*sizeof(t)))) +#define Renewc(v,n,t,c) (v = (c*)safexrealloc((Malloc_t)(v),(MEM_SIZE)((n)*sizeof(t)))) +#define Safefree(d) safexfree((Malloc_t)d) #define NEWSV(x,len) newSV(x,len) #define MAXXCOUNT 1200 long xcount[MAXXCOUNT];