Asserts are sometimes compiled out, so the redundant check is necessary. The optimizer will cull it if asserts are enabled, so it doesn't hurt the generated code.

On 07/23/2015 06:52 AM, Denil Vira wrote:
Coverity Scan ID 1302488. Test for size==0 makes no sense, since assert 
immediately before it
would not let this code happen.

Signed-off-by: Denil Vira <[email protected]>
---
  lib/stream.c | 6 ------
  1 file changed, 6 deletions(-)

diff --git a/lib/stream.c b/lib/stream.c
index e13da08..cd256e2 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -93,12 +93,6 @@ stream_new (size_t size)

    assert (size > 0);

-  if (size == 0)
-    {
-      zlog_warn ("stream_new(): called with 0 size!");
-      return NULL;
-    }
-
    s = XCALLOC (MTYPE_STREAM, sizeof (struct stream));

    if (s == NULL)



_______________________________________________
Quagga-dev mailing list
[email protected]
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to