summaryrefslogtreecommitdiff
path: root/malloc.c
diff options
context:
space:
mode:
authorLarry Wall <lwall@netlabs.com>1991-06-06 23:28:07 +0000
committerLarry Wall <lwall@netlabs.com>1991-06-06 23:28:07 +0000
commit352d5a3ab0aab9889c59e847643d265e062cec0b (patch)
treee0189b7c762b8e87cf461b329640d6efdfab3520 /malloc.c
parent6e21c824d91ef0b4ae60b95b347e344e5bb4d38a (diff)
downloadperl-352d5a3ab0aab9889c59e847643d265e062cec0b.tar.gz
perl 4.0 patch 7: patch #4, continued
See patch #4.
Diffstat (limited to 'malloc.c')
-rw-r--r--malloc.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/malloc.c b/malloc.c
index fece175e00..72a265ed6e 100644
--- a/malloc.c
+++ b/malloc.c
@@ -1,6 +1,9 @@
-/* $RCSfile: malloc.c,v $$Revision: 4.0.1.1 $$Date: 91/04/11 17:48:31 $
+/* $RCSfile: malloc.c,v $$Revision: 4.0.1.2 $$Date: 91/06/07 11:20:45 $
*
* $Log: malloc.c,v $
+ * Revision 4.0.1.2 91/06/07 11:20:45 lwall
+ * patch4: many, many itty-bitty portability fixes
+ *
* Revision 4.0.1.1 91/04/11 17:48:31 lwall
* patch1: Configure now figures out malloc ptr type
*
@@ -160,7 +163,7 @@ malloc(nbytes)
p->ov_rmagic = RMAGIC;
*((u_int *)((caddr_t)p + nbytes - RSLOP)) = RMAGIC;
#endif
- return ((char *)(p + 1));
+ return ((MALLOCPTRTYPE *)(p + 1));
}
/*
@@ -230,11 +233,12 @@ morecore(bucket)
}
void
-free(cp)
- char *cp;
+free(mp)
+ MALLOCPTRTYPE *mp;
{
register int size;
register union overhead *op;
+ char *cp = (char*)mp;
if (cp == NULL)
return;
@@ -277,8 +281,8 @@ free(cp)
int reall_srchlen = 4; /* 4 should be plenty, -1 =>'s whole list */
MALLOCPTRTYPE *
-realloc(cp, nbytes)
- char *cp;
+realloc(mp, nbytes)
+ MALLOCPTRTYPE *mp;
unsigned nbytes;
{
register u_int onb;
@@ -286,6 +290,7 @@ realloc(cp, nbytes)
char *res;
register int i;
int was_alloced = 0;
+ char *cp = (char*)mp;
if (cp == NULL)
return (malloc(nbytes));
@@ -331,15 +336,15 @@ realloc(cp, nbytes)
*((u_int *)((caddr_t)op + nbytes - RSLOP)) = RMAGIC;
}
#endif
- return(cp);
+ return((MALLOCPTRTYPE*)cp);
}
- if ((res = malloc(nbytes)) == NULL)
+ if ((res = (char*)malloc(nbytes)) == NULL)
return (NULL);
if (cp != res) /* common optimization */
(void)bcopy(cp, res, (int)((nbytes < onb) ? nbytes : onb));
if (was_alloced)
free(cp);
- return (res);
+ return ((MALLOCPTRTYPE*)res);
}
/*