aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorDavid Perry <boolean263@protonmail.com>2023-02-13 15:11:46 -0500
committerJohn Thacker <johnthacker@gmail.com>2023-02-25 05:32:48 +0000
commit1f59c187691761ef28837c1caf1c68a1a5cf7072 (patch)
tree154f86dc433ce86d752984b94102f647a42cf4ff /plugins
parent39aa3cb58af77a91e05972a440d35fbb93d4273d (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 'plugins')
-rw-r--r--plugins/epan/ethercat/packet-ecatmb.c6
-rw-r--r--plugins/epan/profinet/packet-pn-dcp.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/plugins/epan/ethercat/packet-ecatmb.c b/plugins/epan/ethercat/packet-ecatmb.c
index 2a7aaab86c..c5998540e5 100644
--- a/plugins/epan/ethercat/packet-ecatmb.c
+++ b/plugins/epan/ethercat/packet-ecatmb.c
@@ -358,7 +358,7 @@ static void CANopenSdoReqFormatter(PETHERCAT_SDO_HEADER pSdo, char *szText, gint
}
}
-static void FoeFormatter(tvbuff_t *tvb, gint offset, char *szText, gint nMax, guint foe_length)
+static void FoeFormatter(tvbuff_t *tvb, wmem_allocator_t *scope, gint offset, char *szText, gint nMax, guint foe_length)
{
ETHERCAT_FOE_HEADER foe;
char *tmp = NULL;
@@ -371,7 +371,7 @@ static void FoeFormatter(tvbuff_t *tvb, gint offset, char *szText, gint nMax, gu
case ECAT_FOE_OPMODE_WRQ:
case ECAT_FOE_OPMODE_ERR:
if ( foe_length > ETHERCAT_FOE_HEADER_LEN ) {
- tmp = tvb_get_string_enc(wmem_packet_scope(), tvb, offset+ETHERCAT_FOE_HEADER_LEN, MIN(foe_length-ETHERCAT_FOE_HEADER_LEN, 49), ENC_ASCII);
+ tmp = tvb_get_string_enc(scope, tvb, offset+ETHERCAT_FOE_HEADER_LEN, MIN(foe_length-ETHERCAT_FOE_HEADER_LEN, 49), ENC_ASCII);
}
break;
}
@@ -1098,7 +1098,7 @@ static void dissect_ecat_foe(tvbuff_t *tvb, gint offset, packet_info *pinfo, pro
if( foe_length >= ETHERCAT_FOE_HEADER_LEN )
{
- FoeFormatter(tvb, offset, szText, nMax, foe_length);
+ FoeFormatter(tvb, pinfo->pool, offset, szText, nMax, foe_length);
col_append_str(pinfo->cinfo, COL_INFO, szText);
if( tree )
diff --git a/plugins/epan/profinet/packet-pn-dcp.c b/plugins/epan/profinet/packet-pn-dcp.c
index b9ab22ba85..01c2829347 100644
--- a/plugins/epan/profinet/packet-pn-dcp.c
+++ b/plugins/epan/profinet/packet-pn-dcp.c
@@ -1051,7 +1051,7 @@ dissect_PNDCP_Suboption_TSN(tvbuff_t* tvb, int offset, packet_info* pinfo,
case PNDCP_SUBOPTION_TSN_DOMAIN_NAME:
offset = dissect_pn_uuid(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_tsn_domain_uuid, &tsn_domain_uuid);
- proto_tree_add_item_ret_display_string(tree, hf_pn_dcp_suboption_tsn_domain_name, tvb, offset, (block_length-16), ENC_ASCII | ENC_NA, wmem_packet_scope(), &domain_name);
+ proto_tree_add_item_ret_display_string(tree, hf_pn_dcp_suboption_tsn_domain_name, tvb, offset, (block_length-16), ENC_ASCII | ENC_NA, pinfo->pool, &domain_name);
pn_append_info(pinfo, dcp_item, ", TSN-Domain Name");
proto_item_append_text(block_item, "TSN/TSN-Domain Name");
@@ -1062,7 +1062,7 @@ dissect_PNDCP_Suboption_TSN(tvbuff_t* tvb, int offset, packet_info* pinfo,
if (have_block_info)
proto_item_append_text(block_item, ", BlockInfo: %s", rval_to_str(block_info, pn_dcp_block_info, "Unknown"));
- pn_append_info(pinfo, dcp_item, wmem_strdup_printf(wmem_packet_scope(), ", DomainName:\"%s\"", domain_name));
+ pn_append_info(pinfo, dcp_item, wmem_strdup_printf(pinfo->pool, ", DomainName:\"%s\"", domain_name));
proto_item_append_text(block_item, ", \"%s\"", domain_name);
offset += (block_length-16);
is_zeros = TRUE;