| 26 |
|
|
| 27 |
|
extern int errno; |
| 28 |
|
|
| 29 |
+ |
#ifndef BSD |
| 30 |
+ |
#define bcopy(s,d,n) (void)memcpy(d,s,n) |
| 31 |
+ |
#define bzero(d,n) (void)memset(d,0,n) |
| 32 |
+ |
extern char *memcpy(), *memset(); |
| 33 |
+ |
#endif |
| 34 |
+ |
|
| 35 |
|
#ifdef MSTATS |
| 36 |
|
#include <stdio.h> |
| 37 |
|
static unsigned b_nsbrked = 0; |
| 175 |
|
big->siz = 0; /* remove from table */ |
| 176 |
|
return(big->ptr); /* return it */ |
| 177 |
|
} |
| 178 |
< |
if (mtablen(big) < tablen+1) { |
| 178 |
> |
if (mtablen(big) <= tablen) { |
| 179 |
|
*np = 0; /* cannot grow table */ |
| 180 |
|
return(NULL); /* report failure */ |
| 181 |
|
} |
| 185 |
|
cptab.ptr = big->ptr; |
| 186 |
|
cptab.siz = big->siz; |
| 187 |
|
big->siz = 0; /* clear and copy */ |
| 182 |
– |
#ifdef BSD |
| 188 |
|
bcopy((char *)tab, (char *)(mtab(&cptab)+1), |
| 189 |
|
tablen*sizeof(struct mblk)); |
| 190 |
|
bzero((char *)(mtab(&cptab)+tablen+1), |
| 191 |
|
(mtablen(&cptab)-tablen-1)*sizeof(struct mblk)); |
| 187 |
– |
#else |
| 188 |
– |
(void)memcpy((char *)(mtab(&cptab)+1), (char *)tab, |
| 189 |
– |
tablen*sizeof(struct mblk)); |
| 190 |
– |
memset((char *)(mtab(&cptab)+tablen+1), 0, |
| 191 |
– |
(mtablen(&cptab)-tablen-1)*sizeof(struct mblk)); |
| 192 |
– |
#endif |
| 192 |
|
} /* next round */ |
| 193 |
|
} |
| 194 |
|
#endif /* MCOMP */ |
| 379 |
|
if ((p = malloc(n)) == NULL) |
| 380 |
|
return(n<=on ? op : NULL); |
| 381 |
|
if (on) { |
| 383 |
– |
#ifdef BSD |
| 382 |
|
bcopy(op, p, n>on ? on : n); |
| 385 |
– |
#else |
| 386 |
– |
(void)memcpy(p, op, n>on ? on : n); |
| 387 |
– |
#endif |
| 383 |
|
free(op); |
| 384 |
|
} |
| 385 |
|
return(p); |