diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2014-11-21 10:25:23 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2014-11-21 10:25:23 +0200 |
commit | 2ef8920a5dfb2d1975deecb83e8239d90a58600c (patch) | |
tree | bd303d0f76ee2e97dcde4b702ff1010630a4eb24 | |
parent | e13c76601a232b24c99a452d8f3403f87f069c22 (diff) | |
download | egawk-2ef8920a5dfb2d1975deecb83e8239d90a58600c.tar.gz egawk-2ef8920a5dfb2d1975deecb83e8239d90a58600c.tar.bz2 egawk-2ef8920a5dfb2d1975deecb83e8239d90a58600c.zip |
Update to xalloc.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | gawkmisc.c | 5 | ||||
-rw-r--r-- | xalloc.h | 2 |
3 files changed, 13 insertions, 3 deletions
@@ -1,3 +1,12 @@ +2014-11-20 Paul Eggert <eggert@cs.ucla.edu> + + Port to systems where malloc (0) and/or realloc(P, 0) returns NULL. + * gawkmisc.c (xmalloc): + * xalloc.h (realloc): + Do not fail if malloc(0) or realloc(P, 0) returns NULL. + Fail only when the allocator returns null when attempting to + allocate a nonzero number of bytes. + 2014-11-19 Arnold D. Robbins <arnold@skeeve.com> Infrastructure upgrades: @@ -51,7 +51,8 @@ extern pointer xmalloc(size_t bytes); /* get rid of gcc warning */ pointer xmalloc(size_t bytes) { - pointer p; - emalloc(p, pointer, bytes, "xmalloc"); + pointer p = malloc(bytes); + if (!p && bytes) + xalloc_die (); return p; } @@ -156,7 +156,7 @@ void * xrealloc(void *p, size_t size) { void *new_p = realloc(p, size); - if (new_p == 0) + if (!new_p && size) xalloc_die (); return new_p; |