]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
wireshark/ceph/packet-ceph.c: fix some issues from cppcheck
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Wed, 13 Feb 2013 18:22:43 +0000 (19:22 +0100)
committerGreg Farnum <greg@inktank.com>
Thu, 14 Feb 2013 18:27:40 +0000 (10:27 -0800)
Fix some smaller performance related issues from cppcheck due to
"Variable '..xy..' is reassigned a value before the old one has been used.

Fix some indention.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
wireshark/ceph/packet-ceph.c

index 2a4e31fad3f66618dde2939c70fa31917c121f63..4379fda0fe0be63e686f4887e604f373cf1fa2ba 100644 (file)
@@ -486,7 +486,7 @@ void proto_register_ceph (void)
        
 static guint32 dissect_sockaddr_in(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
 {
-       proto_tree *ceph_sockaddr_tree = NULL;
+       proto_tree *ceph_sockaddr_tree;
        proto_item *ceph_sub_item = NULL;
        proto_item *ceph_item = proto_tree_get_parent(tree);
 
@@ -581,11 +581,11 @@ static guint32 dissect_ceph_footer(tvbuff_t *tvb, proto_tree *tree, guint32 offs
 
 static guint32 dissect_ceph_client_connect(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
 {
-       proto_tree *ceph_header_tree = NULL;
+       proto_tree *ceph_header_tree;
        proto_item *ceph_sub_item = NULL;
        proto_item *ceph_item = proto_tree_get_parent(tree);
        struct ceph_msg_connect *msg;
-       guint32 auth_len = 0;
+       guint32 auth_len;
 
        offset = dissect_ceph_banner(tvb, tree, offset);
 
@@ -623,7 +623,7 @@ static guint32 dissect_ceph_client_connect(tvbuff_t *tvb, proto_tree *tree, guin
 
 static guint32 dissect_ceph_server_connect(tvbuff_t *tvb, proto_tree *tree, guint32 offset)
 {
-       proto_tree *ceph_header_tree = NULL;
+       proto_tree *ceph_header_tree;
        proto_item *ceph_sub_item = NULL;
        proto_item *ceph_item = proto_tree_get_parent(tree);
        struct ceph_msg_connect_reply *msg;
@@ -1093,7 +1093,7 @@ static guint32 dissect_ceph_front(tvbuff_t *tvb, packet_info *pinfo, proto_tree
 
 static guint32 dissect_ceph_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset)
 {
-       proto_tree *ceph_header_tree = NULL;
+       proto_tree *ceph_header_tree;
        proto_item *ceph_sub_item = NULL;
        proto_item *ceph_item = proto_tree_get_parent(tree);
        guint32 front_len, middle_len, data_len;
@@ -1103,12 +1103,12 @@ static guint32 dissect_ceph_generic(tvbuff_t *tvb, packet_info *pinfo, proto_tre
        guint16 type;
        guint64 seq;
        struct ceph_msg_header *header;
-    unsigned int data_crc = 0;
+       unsigned int data_crc = 0;
 
-    tag = tvb_get_guint8(tvb, offset);
-    hlen = ( tag == CEPH_MSGR_TAG_ACK ) ? ACK_MSG_SIZE:0;
-    hlen += sizeof(struct ceph_msg_header);
-    hlen++;
+       tag = tvb_get_guint8(tvb, offset);
+       hlen = ( tag == CEPH_MSGR_TAG_ACK ) ? ACK_MSG_SIZE:0;
+       hlen += sizeof(struct ceph_msg_header);
+       hlen++;
 
        ceph_header_tree = proto_item_add_subtree(ceph_item, ett_ceph);