From 04a04e162886ca9bc3977d3a7509def876487921 Mon Sep 17 00:00:00 2001 From: Mikhail Gusarov Date: Mon, 25 Oct 2010 01:27:46 +0400 Subject: [PATCH 1/3] Remove now-misleading comment Signed-off-by: Mikhail Gusarov Reviewed-by: Alan Coopersmith --- os/log.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/os/log.c b/os/log.c index ee4b45fa4..3435da6f0 100644 --- a/os/log.c +++ b/os/log.c @@ -302,10 +302,6 @@ LogVWrite(int verb, const char *f, va_list args) #endif } } else if (needBuffer) { - /* - * Note, this code is used before OsInit() has been called, so - * malloc() and friends can't be used. - */ if (len > bufferUnused) { bufferSize += 1024; bufferUnused += 1024; From 433dddcf29d257310e95e4215dceef8b0b976e2d Mon Sep 17 00:00:00 2001 From: Mikhail Gusarov Date: Mon, 25 Oct 2010 01:28:38 +0400 Subject: [PATCH 2/3] Replace "if(buf) realloc(buf, size) else malloc(size)" with realloc() Signed-off-by: Mikhail Gusarov Reviewed-by: Alan Coopersmith --- os/log.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/os/log.c b/os/log.c index 3435da6f0..d18f9b3aa 100644 --- a/os/log.c +++ b/os/log.c @@ -305,10 +305,7 @@ LogVWrite(int verb, const char *f, va_list args) if (len > bufferUnused) { bufferSize += 1024; bufferUnused += 1024; - if (saveBuffer) - saveBuffer = realloc(saveBuffer, bufferSize); - else - saveBuffer = malloc(bufferSize); + saveBuffer = realloc(saveBuffer, bufferSize); if (!saveBuffer) FatalError("realloc() failed while saving log messages\n"); } From 44e81654147065b7b907ce0d14fdc2e74a638f79 Mon Sep 17 00:00:00 2001 From: Mikhail Gusarov Date: Mon, 25 Oct 2010 01:30:33 +0400 Subject: [PATCH 3/3] Remove now-misleading comment Signed-off-by: Mikhail Gusarov Reviewed-by: Alan Coopersmith --- os/log.c | 1 - 1 file changed, 1 deletion(-) diff --git a/os/log.c b/os/log.c index d18f9b3aa..76b6b84a1 100644 --- a/os/log.c +++ b/os/log.c @@ -177,7 +177,6 @@ LogInit(const char *fname, const char *backup) char *logFileName = NULL; if (fname && *fname) { - /* malloc() can't be used yet. */ logFileName = malloc(strlen(fname) + strlen(display) + 1); if (!logFileName) FatalError("Cannot allocate space for the log file name\n");