home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Best of Mecomp Multimedia 2
/
MECOMP-CD-II.iso
/
amiga
/
programmieren
/
c
/
vbcc
/
machines
/
amiga68k
/
libsrc
/
stdlib
/
realloc.c
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
C/C++ Source or Header
|
1997-12-30
|
381 b
|
19 lines
#include <stdlib.h>
#include <string.h>
void *realloc(void *old,size_t nsize)
{
size_t osize;void *new;
union _mheader *mp;
if(!old) return(malloc(nsize));
mp=(union _mheader *)old;
mp--;
osize=(mp->s.size-1)*sizeof(union _mheader);
if(new=malloc(nsize)){
memcpy(new,old,osize>nsize ? nsize:osize);
free(old);
}
return(new);
}