You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2019/02/20 15:45:15 UTC

[qpid-proton] branch master updated: NO-JIRA: [c] Fix "Logically dead code" warning caused by excessive NULL checks

This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git


The following commit(s) were added to refs/heads/master by this push:
     new c403a2d  NO-JIRA: [c] Fix "Logically dead code" warning caused by excessive NULL checks
c403a2d is described below

commit c403a2dbc34e04fc7832d9ac75f2db4e64b2f247
Author: Jiri Danek <jd...@redhat.com>
AuthorDate: Wed Feb 20 10:07:40 2019 +0100

    NO-JIRA: [c] Fix "Logically dead code" warning caused by excessive NULL checks
    
    dead_error_line: Execution cannot reach the expression 0UL inside this statement: *actual = (buf ? needed : 0...
---
 c/tools/reactor-recv.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/c/tools/reactor-recv.c b/c/tools/reactor-recv.c
index e26d892..a876492 100644
--- a/c/tools/reactor-recv.c
+++ b/c/tools/reactor-recv.c
@@ -94,19 +94,17 @@ typedef struct {
   pn_link_t *reply_link;
 } connection_context_t;
 
-
+/**
+ * @return buffer of sufficient size, or NULL
+ */
 static char *ensure_buffer(char *buf, size_t needed, size_t *actual)
 {
-  char* new_buf;
   // Make room for the largest message seen so far, plus extra for slight changes in metadata content
   if (needed + 1024 <= *actual)
     return buf;
   needed += 2048;
-  new_buf = (char *) realloc(buf, needed);
-  if (new_buf != NULL) {
-    buf = new_buf;
-    *actual = buf ? needed : 0;
-  }
+  buf = (char *) realloc(buf, needed);
+  *actual = buf ? needed : 0;
   return buf;
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org