forked from osmocom/wireshark
![]() This commit replaces instances of (myobj *)wmem_alloc(wmem_X_scope(), sizeof(myobj)) and replaces them with: wmem_new(wmem_X_scope(), myobj) to improve the readability of Wireshark's code. Replacements were made with the following Python script: import os import re import sys pattern = r'\(([^\s\n]+) ?\*\) ?wmem_alloc(0?)\((wmem_[a-z]+_scope\(\)), sizeof\(\1\)\)' replacewith = r'wmem_new\2(\3, \1)' startdir = sys.argv[1] for root, dirs, files in os.walk(startdir): for fname in files: fpath = os.path.join(root, fname) if not fpath.endswith('.c'): continue with open(fpath, 'r') as fh: fdata = fh.read() output = re.sub(pattern, replacewith, fdata) if fdata != output: print(fpath) with open(fpath, 'w') as fh: fh.write(output) Change-Id: I223cb2fcce336bc99ca21c4a74e4cf758fd00572 Reviewed-on: https://code.wireshark.org/review/38088 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com> |
||
---|---|---|
.. | ||
codecs | ||
epan | ||
wiretap/usbdump | ||
plugin.rc.in |