aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/epan/ethercat
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/epan/ethercat
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/epan/ethercat')
-rw-r--r--plugins/epan/ethercat/packet-ecatmb.c6
1 files changed, 3 insertions, 3 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 )