]> granicus.if.org Git - neomutt/commitdiff
coverity: refactor only
authorRichard Russon <rich@flatcap.org>
Wed, 5 Apr 2017 14:29:36 +0000 (15:29 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 10 Apr 2017 13:32:13 +0000 (14:32 +0100)
Refactor code for clarity.

buffer.c

index 665dc5aebf87c185386b27059b4d16fe3390b90a..d57895004c38a695bd81b7b6262d7ebc967d779c 100644 (file)
--- a/buffer.c
+++ b/buffer.c
@@ -119,14 +119,11 @@ static void mutt_buffer_add (BUFFER* buf, const char* s, size_t len)
   if (!buf || !s)
     return;
 
-  size_t offset;
-
-  if (buf->dptr + len + 1 > buf->data + buf->dsize)
+  if ((buf->dptr + len + 1) > (buf->data + buf->dsize))
   {
-    offset = buf->dptr - buf->data;
-    buf->dsize += len < 128 ? 128 : len + 1;
-    /* suppress compiler aliasing warning */
-    safe_realloc ((void**) (void*) &buf->data, buf->dsize);
+    size_t offset = buf->dptr - buf->data;
+    buf->dsize += (len < 128) ? 128 : len + 1;
+    safe_realloc (&buf->data, buf->dsize);
     buf->dptr = buf->data + offset;
   }
   if (!buf->dptr)