diff --git a/basicdefs.h b/basicdefs.h index 337cebc..be6384f 100644 --- a/basicdefs.h +++ b/basicdefs.h @@ -34,7 +34,7 @@ typedef unsigned long countT; #include "xalloc.h" /* some basic definitions to avoid undue promulgating of ugliness */ -#define REALLOC(x,n,t) ((t *)ck_realloc((void *)(x),(n)*sizeof(t))) +#define REALLOC(x,n,t) ((t *)xnrealloc((void *)(x),(n),sizeof(t))) #define MEMDUP(x,n,t) ((t *)xmemdup((x),(n)*sizeof(t))) #define OB_MALLOC(o,n,t) ((t *)(void *)obstack_alloc(o,(n)*sizeof(t))) diff --git a/sed/utils.c b/sed/utils.c index 7138b8b..1ce627e 100644 --- a/sed/utils.c +++ b/sed/utils.c @@ -319,8 +319,8 @@ follow_symlink(const char *fname) while ((rc = readlink (buf, buf2, buf_size)) == buf_size) { buf_size *= 2; - buf1 = ck_realloc (buf1, buf_size); - buf2 = ck_realloc (buf2, buf_size); + buf1 = xrealloc (buf1, buf_size); + buf2 = xrealloc (buf2, buf_size); } if (rc < 0) panic (_("couldn't follow symlink %s: %s"), buf, strerror(errno)); @@ -335,8 +335,8 @@ follow_symlink(const char *fname) if (len + rc + 1 > buf_size) { buf_size = len + rc + 1; - buf1 = ck_realloc (buf1, buf_size); - buf2 = ck_realloc (buf2, buf_size); + buf1 = xrealloc (buf1, buf_size); + buf2 = xrealloc (buf2, buf_size); } /* Always store the new path in buf1. */ @@ -393,25 +393,6 @@ ck_rename (const char *from, const char *to, const char *unlink_if_fail) -/* Panic on failing realloc */ -void * -ck_realloc(void *ptr, size_t size) -{ - void *ret; - - if (size == 0) - { - free(ptr); - return NULL; - } - if (!ptr) - return xzalloc(size); - ret = realloc(ptr, size); - if (!ret) - panic("couldn't re-allocate memory"); - return ret; -} - /* Implement a variable sized buffer of `stuff'. We don't know what it is, nor do we care, as long as it doesn't mind being aligned by malloc. */