mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-28 17:32:29 +01:00
Changed wrealloc's behaviour to call wfree() and return NULL if the newly
requested size is 0.
This commit is contained in:
@@ -29,6 +29,10 @@ changes since wmaker 0.61.1:
|
|||||||
problem with them: inability to remove handlers next to the called one, from
|
problem with them: inability to remove handlers next to the called one, from
|
||||||
the called handler itself. Trying to do this with the old version caused the
|
the called handler itself. Trying to do this with the old version caused the
|
||||||
program to crash.
|
program to crash.
|
||||||
|
- changed wrealloc behaviour to be like this: new = wrealloc(old, new_size);
|
||||||
|
1. if old is NULL, return wmalloc(new_size).
|
||||||
|
2. if new_size is 0, call wfree(old), and return NULL.
|
||||||
|
3. if both old is a valid pointer and new_size>0, call realloc.
|
||||||
|
|
||||||
changes since wmaker 0.61.0:
|
changes since wmaker 0.61.0:
|
||||||
............................
|
............................
|
||||||
|
|||||||
@@ -114,6 +114,9 @@ void *wrealloc(void *ptr, size_t newsize)
|
|||||||
|
|
||||||
if (!ptr) {
|
if (!ptr) {
|
||||||
nptr = wmalloc(newsize);
|
nptr = wmalloc(newsize);
|
||||||
|
} else if (newsize==0) {
|
||||||
|
wfree(ptr);
|
||||||
|
nptr = NULL;
|
||||||
} else {
|
} else {
|
||||||
#ifdef TEST_WITH_GC
|
#ifdef TEST_WITH_GC
|
||||||
nptr = GC_realloc(ptr, newsize);
|
nptr = GC_realloc(ptr, newsize);
|
||||||
|
|||||||
Reference in New Issue
Block a user