From 114a8e0fd8f9ac99b906603f28374f0cf83856d3 Mon Sep 17 00:00:00 2001 From: marc Date: Wed, 11 Mar 1998 23:28:47 +0000 Subject: [PATCH] Work around broken realloc()'s. CVS patchset: 2037 CVS date: 1998/03/11 23:28:47 --- build/macro.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build/macro.c b/build/macro.c index dc6e617..eb02b61 100644 --- a/build/macro.c +++ b/build/macro.c @@ -273,8 +273,13 @@ static int compareMacros(const void *ap, const void *bp) static void expandMacroTable(struct MacroContext *mc) { mc->macrosAllocated += MACRO_CHUNK_SIZE; - mc->macroTable = realloc(mc->macroTable, sizeof(*(mc->macroTable)) * - mc->macrosAllocated); + if (mc->macroTable) { + mc->macroTable = realloc(mc->macroTable, sizeof(*(mc->macroTable)) * + mc->macrosAllocated); + } else { + mc->macroTable = malloc(sizeof(*(mc->macroTable)) * + mc->macrosAllocated); + } } /***********************************************************************/ -- 2.7.4