From 5e887908b34b804a19b2b7370b0aa358d0e55973 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Fri, 30 Apr 2010 16:06:03 +0000 Subject: Consolidate several 'myrealloc' functions into ns_realloc, rename one which *is* different, thereby eliminating the word 'myrealloc' from the NS codebase svn path=/trunk/netsurf/; revision=10530 --- utils/utils.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'utils/utils.c') diff --git a/utils/utils.c b/utils/utils.c index 175b33073..346fd5585 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -39,6 +39,19 @@ #include "utils/utf8.h" #include "utils/utils.h" +void * +ns_realloc(void *ptr, size_t size, void *pw) +{ + (void)pw; + + if (ptr == NULL) + return size > 0 ? malloc(size) : NULL; + if (size == 0) { + free(ptr); + return NULL; + } + return realloc(ptr, size); +} char * strip(char * const s) { -- cgit v1.2.3