diff options
author | Paul Smith <psmith@gnu.org> | 2004-01-07 19:36:39 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2004-01-07 19:36:39 +0000 |
commit | a35db9027526a8cad59c4e139ab224946245a7f7 (patch) | |
tree | 010e38117617a73053a9ac5fbecf3316b2eff705 /misc.c | |
parent | ee3d37a591cf2db3dd1444b2c1e2fcb041f68d33 (diff) | |
download | gunmake-a35db9027526a8cad59c4e139ab224946245a7f7.tar.gz |
Fix order-only prerequisites for pattern rules. (Savannah patch #2349).
Add a regression test for this.
Older libraries don't allow *alloc(0), so make sure we don't ever do that.
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -357,7 +357,8 @@ pfatal_with_name (const char *name) char * xmalloc (unsigned int size) { - char *result = (char *) malloc (size); + /* Make sure we don't allocate 0, for pre-ANSI libraries. */ + char *result = (char *) malloc (size ? size : 1); if (result == 0) fatal (NILF, _("virtual memory exhausted")); return result; @@ -370,6 +371,8 @@ xrealloc (char *ptr, unsigned int size) char *result; /* Some older implementations of realloc() don't conform to ANSI. */ + if (! size) + size = 1; result = ptr ? realloc (ptr, size) : malloc (size); if (result == 0) fatal (NILF, _("virtual memory exhausted")); |