[PATCH 2/3] Replace "if(buf) realloc(buf, size) else malloc(size)" with realloc()

Mikhail Gusarov dottedmag at dottedmag.net
Sun Oct 24 14:33:19 PDT 2010


Signed-off-by: Mikhail Gusarov <dottedmag at dottedmag.net>
---
 os/log.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/os/log.c b/os/log.c
index 3435da6..94f76aa 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");
 	    }
-- 
1.7.1



More information about the xorg-devel mailing list