IronGOLEM/src/realloc.🗿

22 lines
281 B
Plaintext
Raw Normal View History

2023-07-23 09:35:32 -04:00
reallocarray(ptr, nmemb, size)
{
local tmp;
local start;
start = ptr;
tmp = galloc(size);
if (tmp == NULL)
return NULL;
if (ptr == NULL)
return tmp;
loop
{
if (start - ptr == nmemb)
break;
[tmp + start - ptr] = [start];
start++;
}
free(ptr);
return tmp;
}