pidl/ws: Fix Dead Store (Dead assignement/Dead increment) warning found by Clang
authorAurelien Aptel <aaptel@suse.com>
Fri, 5 Feb 2016 13:43:04 +0000 (14:43 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 20 Jun 2016 10:08:20 +0000 (12:08 +0200)
Port Wireshark commit f6b9e7a

Author: Alexis La Goutte <alexis.lagoutte@gmail.com>
Date:   Sun Sep 28 20:57:13 2014 +0200

    PIDL: Fix Dead Store (Dead assignement/Dead increment) warning found by Clang

    Change-Id: Ibae478771b30d6e9ae07315985f1e71bc6b65423
    Reviewed-on: https://code.wireshark.org/review/4350
Reviewed-by: Michael Mann <mmann78@netscape.net>
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
pidl/lib/Parse/Pidl/Wireshark/NDR.pm

index 698f8c61a5e277fe1e58aac238fa309b1e6e8078..40c59c9a5176fc203654965ae493c9a19e79594b 100644 (file)
@@ -690,7 +690,9 @@ sub Struct($$$$)
        $self->indent;
        $self->pidl_code($_) foreach (@$vars);
        $self->pidl_code("proto_item *item = NULL;");
-       $self->pidl_code("proto_tree *tree = NULL;");
+       if($res) {
+               $self->pidl_code("proto_tree *tree = NULL;");
+       }
        if (defined($doalign)) {
                $self->pidl_code("dcerpc_info *di = (dcerpc_info *)pinfo->private_data;");
                if ($doalign == 0) {
@@ -715,7 +717,9 @@ sub Struct($$$$)
        $self->pidl_code("if (parent_tree) {");
        $self->indent;
        $self->pidl_code("item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, ENC_NA);");
-       $self->pidl_code("tree = proto_item_add_subtree(item, ett_$ifname\_$name);");
+       if($res) {
+               $self->pidl_code("tree = proto_item_add_subtree(item, ett_$ifname\_$name);");
+       }
        $self->deindent;
        $self->pidl_code("}");