fix realloc and friends (obs from Nuno Fonseca).

This commit is contained in:
Vítor Manuel de Morais Santos Costa
2009-11-27 13:31:03 +00:00
parent d746afaa32
commit b16623d026
5 changed files with 30 additions and 6 deletions

View File

@@ -1304,7 +1304,7 @@ X_API void *
YAP_ReallocSpaceFromYap(void *ptr,unsigned int size) {
void *new_ptr;
BACKUP_MACHINE_REGS();
while ((new_ptr = Yap_ExpandPreAllocCodeSpace(size,ptr,TRUE)) == NULL) {
while ((new_ptr = Yap_ReallocCodeSpace(size,ptr)) == NULL) {
if (!Yap_growheap(FALSE, size, NULL)) {
Yap_Error(OUT_OF_HEAP_ERROR, TermNil, Yap_ErrorMessage);
return NULL;
@@ -1325,7 +1325,6 @@ YAP_AllocSpaceFromYap(unsigned int size)
return NULL;
}
}
RECOVER_MACHINE_REGS();
return ptr;
}