--- ray/src/common/malloc.c 1995/11/10 17:04:15 2.10 +++ ray/src/common/malloc.c 2003/06/30 14:59:11 2.16 @@ -1,9 +1,6 @@ -/* Copyright (c) 1992 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: malloc.c,v 2.16 2003/06/30 14:59:11 schorsch Exp $"; #endif - /* * Fast malloc for memory hogs and VM environments. * Performs a minimum of searching through free lists. @@ -22,12 +19,11 @@ static char SCCSid[] = "$SunId$ LBL"; * Greg Ward Lawrence Berkeley Laboratory */ +#include "copyright.h" + #include +#include -#ifndef BSD -#define bcopy(s,d,n) (void)memcpy(d,s,n) -#define bzero(d,n) (void)memset(d,0,n) -#endif #ifdef MSTATS #include @@ -43,10 +39,10 @@ static unsigned m_nwasted = 0; #define NULL 0 #endif -#ifndef ALIGN -#define ALIGN int /* align type */ +#ifndef ALIGNT +#define ALIGNT int /* align type */ #endif -#define BYTES_WORD sizeof(ALIGN) +#define BYTES_WORD sizeof(ALIGNT) #ifndef MAXINCR #define MAXINCR (1<<16) /* largest sbrk(2) increment */ @@ -58,7 +54,7 @@ typedef union m_head { short magic; short bucket; } a; - ALIGN dummy; + ALIGNT dummy; } M_HEAD; #define MAGIC 0x1a2 /* magic number for allocated memory */ @@ -68,7 +64,7 @@ typedef union m_head { static M_HEAD *free_list[NBUCKETS]; -static ALIGN dummy_mem; +static ALIGNT dummy_mem; static char *memlim[2]; @@ -183,9 +179,9 @@ unsigned *np; cptab.ptr = big->ptr; cptab.siz = big->siz; big->siz = 0; /* clear and copy */ - bcopy((char *)tab, (char *)(mtab(&cptab)+1), + memcpy((char *)(mtab(&cptab)+1), (char *)tab, tablen*sizeof(struct mblk)); - bzero((char *)(mtab(&cptab)+tablen+1), + memset((char *)(mtab(&cptab)+tablen+1), '\0', (mtablen(&cptab)-tablen-1)*sizeof(struct mblk)); } /* next round */ } @@ -303,7 +299,7 @@ register unsigned n; register int bucket; register unsigned bsiz; - if (n < 1<on ? on : n); + memcpy(p, op, n>on ? on : n); free(op); } return(p);