aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/lte-rrc
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/asn1/lte-rrc
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/asn1/lte-rrc')
-rw-r--r--epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c b/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c
index f5bc326fd7..360bd2270f 100644
--- a/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c
+++ b/epan/dissectors/asn1/lte-rrc/packet-lte-rrc-template.c
@@ -2702,7 +2702,7 @@ static lte_rrc_private_data_t* lte_rrc_get_private_data(asn1_ctx_t *actx)
}
else {
lte_rrc_private_data_t* new_struct =
- (lte_rrc_private_data_t*)wmem_alloc0(wmem_packet_scope(), sizeof(lte_rrc_private_data_t));
+ wmem_new0(wmem_packet_scope(), lte_rrc_private_data_t);
actx->private_data = new_struct;
return new_struct;
}