aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rtitcp.c
diff options
context:
space:
mode:
authorMoshe Kaplan <me@moshekaplan.com>2020-05-07 08:35:45 -0400
committerPascal Quantin <pascal@wireshark.org>2020-05-07 14:47:54 +0000
commitfd7895d37c2410f81231efdfd8b0640c15887a70 (patch)
tree899b653a9baa87e6a4f54dd7d7d8e6fd42aa1223 /epan/dissectors/packet-rtitcp.c
parent87f320ec25a27f06e90f68a200ab7702a5b7c850 (diff)
Replace instances of wmem_alloc with wmem_new
This commit replaces instances of (myobj *)wmem_alloc(wmem_file_scope(), sizeof(myobj)) and replaces them with: wmem_new(wmem_file_scope(), myobj) to improve the readability of Wireshark's code. The replacement locations were identified with grep and replaced with the Python script below. grep command: egrep "wmem_alloc0?\(wmem_file_scope\(\), sizeof\([a-z_]+\)\)" . -R -l python script: import re import sys import fileinput pattern = r'\(([^\s]+) ?\*\) ?wmem_alloc(0?)\((wmem_[a-z]+_scope\(\)), sizeof\(\1\)\)' replacewith = r'wmem_new\2(\3, \1)' fname = sys.argv[1] for line in fileinput.input(fname, inplace=1, mode='rb'): output = re.sub(pattern, replacewith, line) sys.stdout.write(output) Change-Id: Ieac246c104bf01e32cbc6e11e53e81c7f639d870 Reviewed-on: https://code.wireshark.org/review/37158 Petri-Dish: Pascal Quantin <pascal@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin <pascal@wireshark.org>
Diffstat (limited to 'epan/dissectors/packet-rtitcp.c')
-rw-r--r--epan/dissectors/packet-rtitcp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/dissectors/packet-rtitcp.c b/epan/dissectors/packet-rtitcp.c
index f750224274..04c3fd56b1 100644
--- a/epan/dissectors/packet-rtitcp.c
+++ b/epan/dissectors/packet-rtitcp.c
@@ -536,7 +536,7 @@ static guint16 dissect_control_message(proto_tree *rtitcp_tree, tvbuff_t *tvb, p
rtitcp_trans->req_frame = pinfo->num;
rtitcp_trans->rep_frame = 0;
rtitcp_trans->req_time = pinfo->abs_ts;
- conversation_info_key = (guint64*)wmem_alloc0(wmem_file_scope(), sizeof(guint64));
+ conversation_info_key = wmem_new0(wmem_file_scope(), guint64);
*conversation_info_key = seq_num;
wmem_map_insert(rtitcp_info->pdus, conversation_info_key, (void *)rtitcp_trans);
} else {