diff options
author | David Perry <boolean263@protonmail.com> | 2023-11-21 16:34:03 -0500 |
---|---|---|
committer | AndersBroman <a.broman58@gmail.com> | 2023-11-22 07:22:10 +0000 |
commit | 24e7627fe401834b3fa02c04934e36e55cd502a2 (patch) | |
tree | fdd901ac7a3c8011c92d6164f6a50ac155b89d75 /epan/dissectors/packet-kafka.c | |
parent | 24c0cba235d221225c2d4380c960642e22fdfc94 (diff) |
Change some `wmem_packet_scope()` to `pinfo->pool`
As requested [here][1], help with removing calls to
`wmem_packet_scope()` in favour of references to `pinfo->pool`.
* Plugins chosen semi-alphabetically.
* 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.
* Some of the files in this MR still have references to
`wmem_packet_scope()` where it would take significant work to remove.
These will need revisiting later.
[1]: https://www.wireshark.org/lists/wireshark-dev/202107/msg00052.html
Diffstat (limited to 'epan/dissectors/packet-kafka.c')
-rw-r--r-- | epan/dissectors/packet-kafka.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/epan/dissectors/packet-kafka.c b/epan/dissectors/packet-kafka.c index c7b7385134..b272dadb89 100644 --- a/epan/dissectors/packet-kafka.c +++ b/epan/dissectors/packet-kafka.c @@ -1369,7 +1369,7 @@ dissect_kafka_timestamp(proto_tree *tree, int hf_item, tvbuff_t *tvb, packet_inf * of ZigZag is very compact representation for small numbers. * * tvb: actual data buffer - * pinfo: packet information (unused) + * pinfo: packet information * tree: protocol information tree to append the item * hf_item: protocol information item descriptor index * offset: offset in the buffer where the string length is to be found @@ -1379,7 +1379,7 @@ dissect_kafka_timestamp(proto_tree *tree, int hf_item, tvbuff_t *tvb, packet_inf * is guaranteed to be set to a valid value. */ static int -dissect_kafka_string_new(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int hf_item, int offset, char **p_display_string) +dissect_kafka_string_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int hf_item, int offset, char **p_display_string) { gint64 val; guint len; @@ -1396,7 +1396,7 @@ dissect_kafka_string_new(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree } else if (val > 0) { // there is payload available, possibly with 0 octets if (p_display_string != NULL) - proto_tree_add_item_ret_display_string(tree, hf_item, tvb, offset+len, (gint)val, ENC_UTF_8, wmem_packet_scope(), p_display_string); + proto_tree_add_item_ret_display_string(tree, hf_item, tvb, offset+len, (gint)val, ENC_UTF_8, pinfo->pool, p_display_string); else proto_tree_add_item(tree, hf_item, tvb, offset+len, (gint)val, ENC_UTF_8); } else if (val == 0) { |