diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2017-06-05 16:14:01 +0200 |
---|---|---|
committer | Martin Kaiser <wireshark@kaiser.cx> | 2017-06-06 18:33:35 +0000 |
commit | dea13b3cac2a99beb1828cba00c6bd36231c7365 (patch) | |
tree | b74813e969ca6f2a1a24fa697f2c1880571ff74e /plugins | |
parent | dd52b1653791a7e4367d134f740b724155063db6 (diff) | |
download | wireshark-dea13b3cac2a99beb1828cba00c6bd36231c7365.tar.gz |
profinet: use proto_tree_add_item_ret_(u)int
profinet has a number of internal functions that add an item to the tree
and read its value. For 32bit integers, this is exactly what
proto_tree_add_item_ret_(u)int do. Just call those functions.
(We could do the same for 8 and 16bit values. We'd need a temporary
value then and the code wouldn't be much easier than it is now.)
Change-Id: I98fc70ced2dc5a552235a476d40a4275f3b3bd38
Reviewed-on: https://code.wireshark.org/review/21965
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/profinet/packet-pn.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/plugins/profinet/packet-pn.c b/plugins/profinet/packet-pn.c index 6cde573b42..0399cf9253 100644 --- a/plugins/profinet/packet-pn.c +++ b/plugins/profinet/packet-pn.c @@ -105,13 +105,9 @@ int dissect_pn_uint32(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, proto_tree *tree, int hfindex, guint32 *pdata) { - guint32 data; - - data = tvb_get_ntohl (tvb, offset); + proto_tree_add_item_ret_uint(tree, hfindex, + tvb, offset, 4, ENC_BIG_ENDIAN, pdata); - proto_tree_add_uint(tree, hfindex, tvb, offset, 4, data); - if (pdata) - *pdata = data; return offset+4; } @@ -135,13 +131,9 @@ int dissect_pn_int32(tvbuff_t *tvb, gint offset, packet_info *pinfo _U_, proto_tree *tree, int hfindex, gint32 *pdata) { - gint32 data; + proto_tree_add_item_ret_int(tree, hfindex, + tvb, offset, 4, ENC_BIG_ENDIAN, pdata); - data = tvb_get_ntohl (tvb, offset); - - proto_tree_add_int(tree, hfindex, tvb, offset, 4, data); - if (pdata) - *pdata = data; return offset + 4; } |