loader: factor out guard location setup from Realloc
To simplify and make it easier to read, use ga_Bytes field from guard structure.
This commit is contained in:
parent
3c19311544
commit
144c4ca039
@ -156,7 +156,9 @@ Realloc(void *ptr, size_t size, const char *file, int line)
|
||||
|
||||
if ((res = Malloc(size, file, line)) != NULL) {
|
||||
if (ptr) {
|
||||
old = *(size_t *)((char *)ptr - MALLOCALIGN) - MALLOCALIGN;
|
||||
Guard *g = (Guard *)((char *)ptr - MALLOCALIGN);
|
||||
|
||||
old = g->ga_Bytes - MALLOCALIGN;
|
||||
if (old < size)
|
||||
bcopy(ptr, res, old);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user