summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-03-08 10:53:59 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-03-08 18:14:33 +0000
commit5df42db79211ce769a6eca4d4e4077de7e558652 (patch)
tree5be3acdb51588cbdc7b34bd1ee16dde63904afd2
parente60890429f6c62bc47395385322602f1642c972a (diff)
Dead code: Remove comma-check in first if-clause (found by Coverity).
Error: DEADCODE: /builddir/build/BUILD/libguestfs-1.16.5/fish/event-names.c:65: dead_error_condition: On this path, the condition "comma" cannot be true. /builddir/build/BUILD/libguestfs-1.16.5/fish/event-names.c:57: const: After this line, the value of "comma" is equal to 0. /builddir/build/BUILD/libguestfs-1.16.5/fish/event-names.c:57: assignment: Assigning: "comma" = "0". /builddir/build/BUILD/libguestfs-1.16.5/fish/event-names.c:65: dead_error_line: Execution cannot reach this statement "fputc(44, fp);". (cherry picked from commit 0ffa223a75fe4b5b077e4ec68534155039772c3a)
-rw-r--r--generator/generator_fish.ml7
1 files changed, 4 insertions, 3 deletions
diff --git a/generator/generator_fish.ml b/generator/generator_fish.ml
index f86d97b1..2ce08d5e 100644
--- a/generator/generator_fish.ml
+++ b/generator/generator_fish.ml
@@ -1009,10 +1009,11 @@ print_event_set (uint64_t event_bitmask, FILE *fp)
";
- List.iter (
- fun (name, _) ->
+ iteri (
+ fun i (name, _) ->
pr " if (event_bitmask & GUESTFS_EVENT_%s) {\n" (String.uppercase name);
- pr " if (comma) fputc (',', fp);\n";
+ if i > 0 then
+ pr " if (comma) fputc (',', fp);\n";
pr " comma = 1;\n";
pr " fputs (\"%s\", fp);\n" name;
pr " }\n"