diff options
author | David Perry <boolean263@protonmail.com> | 2023-02-13 15:11:46 -0500 |
---|---|---|
committer | John Thacker <johnthacker@gmail.com> | 2023-02-25 05:32:48 +0000 |
commit | 1f59c187691761ef28837c1caf1c68a1a5cf7072 (patch) | |
tree | 154f86dc433ce86d752984b94102f647a42cf4ff /epan/dissectors/packet-batadv.c | |
parent | 39aa3cb58af77a91e05972a440d35fbb93d4273d (diff) |
Change some `wmem_packet_scope()` to `pinfo->pool`
As requested [here][1] by @eapache, help with removing calls to
`wmem_packet_scope()` in favour of references to `pinfo->pool`.
* Plugins chosen semi-randomly.
* When a calling function already has a `pinfo` argument, use that.
* Remove `_U_` from its signature if it was there.
* If a function seems narrowly focused on getting and (possibly)
returning memory, change the function signature to take a
`wmem_allocator_t *`.
* If it seems more focused on packet-based operations, pass in a
`packet_info *` instead and use `pinfo->pool` within.
* If there are several functions defined with the same call
signature, add `pinfo _U_` to the argument list of similar
functions in order to maintain clarity/symmetry.
[1]: https://www.wireshark.org/lists/wireshark-dev/202107/msg00052.html
Diffstat (limited to 'epan/dissectors/packet-batadv.c')
-rw-r--r-- | epan/dissectors/packet-batadv.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/epan/dissectors/packet-batadv.c b/epan/dissectors/packet-batadv.c index 1a88d70389..54ff6fe6cd 100644 --- a/epan/dissectors/packet-batadv.c +++ b/epan/dissectors/packet-batadv.c @@ -2132,7 +2132,7 @@ static void dissect_batadv_icmp_v6(tvbuff_t *tvb, packet_info *pinfo, proto_tree } static void -dissect_batadv_icmp_rr(proto_tree *batadv_icmp_tree, tvbuff_t *tvb, int offset) +dissect_batadv_icmp_rr(packet_info *pinfo, proto_tree *batadv_icmp_tree, tvbuff_t *tvb, int offset) { proto_tree *field_tree; int ptr, i; @@ -2149,7 +2149,7 @@ dissect_batadv_icmp_rr(proto_tree *batadv_icmp_tree, tvbuff_t *tvb, int offset) offset++; for (i = 0; i < BAT_RR_LEN; i++) { proto_tree_add_ether_format(field_tree, hf_batadv_icmp_rr_ether, tvb, offset, 6, tvb_get_ptr(tvb, offset, 6), - "%s%s", (i > ptr) ? "-" : tvb_ether_to_str(wmem_packet_scope(), tvb, offset), + "%s%s", (i > ptr) ? "-" : tvb_ether_to_str(pinfo->pool, tvb, offset), (i == ptr) ? " <- (current)" : ""); offset += 6; @@ -2157,7 +2157,7 @@ dissect_batadv_icmp_rr(proto_tree *batadv_icmp_tree, tvbuff_t *tvb, int offset) } static void -dissect_batadv_icmp_rr_v15(proto_tree *batadv_icmp_tree, tvbuff_t *tvb, +dissect_batadv_icmp_rr_v15(packet_info *pinfo, proto_tree *batadv_icmp_tree, tvbuff_t *tvb, int offset, int ptr) { proto_tree *field_tree; @@ -2174,7 +2174,7 @@ dissect_batadv_icmp_rr_v15(proto_tree *batadv_icmp_tree, tvbuff_t *tvb, tvb, offset, 6, tvb_get_ptr(tvb, offset, 6), "%s%s", - (i > ptr) ? "-" : tvb_ether_to_str(wmem_packet_scope(), tvb, offset), + (i > ptr) ? "-" : tvb_ether_to_str(pinfo->pool, tvb, offset), (i == ptr) ? " <- (current)" : ""); offset += 6; @@ -2248,7 +2248,7 @@ static void dissect_batadv_icmp_v7(tvbuff_t *tvb, packet_info *pinfo, proto_tree /* rr data available? */ length_remaining = tvb_reported_length_remaining(tvb, offset); if (length_remaining >= 1 + BAT_RR_LEN * 6) { - dissect_batadv_icmp_rr(batadv_icmp_tree, tvb, offset); + dissect_batadv_icmp_rr(pinfo, batadv_icmp_tree, tvb, offset); offset += 1 + BAT_RR_LEN * 6; } @@ -2332,7 +2332,7 @@ static void dissect_batadv_icmp_v14(tvbuff_t *tvb, packet_info *pinfo, proto_tre /* rr data available? */ length_remaining = tvb_reported_length_remaining(tvb, offset); if (length_remaining >= 1 + BAT_RR_LEN * 6) { - dissect_batadv_icmp_rr(batadv_icmp_tree, tvb, offset); + dissect_batadv_icmp_rr(pinfo, batadv_icmp_tree, tvb, offset); offset += 1 + BAT_RR_LEN * 6; } @@ -2534,7 +2534,7 @@ static void dissect_batadv_icmp_simple_v15(tvbuff_t *tvb, packet_info *pinfo, /* rr data available? */ length_remaining = tvb_reported_length_remaining(tvb, offset); if (length_remaining >= BAT_RR_LEN * 6) { - dissect_batadv_icmp_rr_v15(batadv_icmp_tree, tvb, offset, + dissect_batadv_icmp_rr_v15(pinfo, batadv_icmp_tree, tvb, offset, icmp_packeth->rr_ptr); offset += BAT_RR_LEN * 6; } |