vppapigen: coverity 219549, dead code in generated file 74/34574/3
authorOle Troan <ot@cisco.com>
Tue, 23 Nov 2021 09:49:36 +0000 (10:49 +0100)
committerDamjan Marion <dmarion@me.com>
Thu, 25 Nov 2021 15:25:34 +0000 (15:25 +0000)
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I64804092917f1d8dc520549bacae81672a95cd1e

src/tools/vppapigen/vppapigen_c.py

index ae47625..d0f63fb 100644 (file)
@@ -206,6 +206,8 @@ class ToJSON():
         write('    cJSON *array = cJSON_CreateArray();\n')
 
         for b in o.block:
+            if b[1] == 0:
+                    continue
             write('    if (a & {})\n'.format(b[0]))
             write('       cJSON_AddItemToArray(array, cJSON_CreateString("{}"));\n'.format(b[0]))
         write('    return array;\n')