Wireshark-commits: [Wireshark-commits] master fd7895d: Replace instances of wmem_alloc with wmem_ne
From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Thu, 07 May 2020 14:48:02 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=fd7895d37c2410f81231efdfd8b0640c15887a70
Submitter: "Pascal Quantin <pascal@xxxxxxxxxxxxx>"
Changed: branch: master
Repository: wireshark

Commits:

fd7895d by Moshe Kaplan (me@xxxxxxxxxxxxxxx):

    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@xxxxxxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Pascal Quantin <pascal@xxxxxxxxxxxxx>
    

Actions performed:

    from  87f320e   IEEE802.11: HS2.0 ANQP Friendly Name Subtree Fix
     add  fd7895d   Replace instances of wmem_alloc with wmem_new


Summary of changes:
 .../asn1/lte-rrc/packet-lte-rrc-template.c         |  2 +-
 epan/dissectors/packet-bthci_acl.c                 |  2 +-
 epan/dissectors/packet-btmesh-proxy.c              |  2 +-
 epan/dissectors/packet-btmesh.c                    |  2 +-
 epan/dissectors/packet-cops.c                      |  2 +-
 epan/dissectors/packet-dcerpc-nt.c                 |  8 ++---
 epan/dissectors/packet-dcerpc.c                    |  2 +-
 epan/dissectors/packet-dcm.c                       |  8 ++---
 epan/dissectors/packet-diameter.c                  | 18 +++++------
 epan/dissectors/packet-dof.c                       | 36 +++++++++++-----------
 epan/dissectors/packet-epl.c                       |  2 +-
 epan/dissectors/packet-gtp.c                       |  2 +-
 epan/dissectors/packet-gvcp.c                      |  4 +--
 epan/dissectors/packet-hislip.c                    |  2 +-
 epan/dissectors/packet-http.c                      |  4 +--
 epan/dissectors/packet-isup.c                      |  4 +--
 epan/dissectors/packet-iwarp-mpa.c                 |  2 +-
 epan/dissectors/packet-lte-rrc.c                   |  2 +-
 epan/dissectors/packet-mac-lte.c                   |  2 +-
 epan/dissectors/packet-mcpe.c                      |  2 +-
 epan/dissectors/packet-mswsp.c                     |  2 +-
 epan/dissectors/packet-mtp2.c                      | 14 ++++-----
 epan/dissectors/packet-pcp.c                       |  2 +-
 epan/dissectors/packet-raknet.c                    |  2 +-
 epan/dissectors/packet-rpcrdma.c                   | 10 +++---
 epan/dissectors/packet-rtitcp.c                    |  2 +-
 epan/dissectors/packet-rtps.c                      |  2 +-
 epan/dissectors/packet-s101.c                      |  2 +-
 epan/dissectors/packet-scylla.c                    |  4 +--
 epan/dissectors/packet-smb.c                       | 28 ++++++++---------
 epan/dissectors/packet-spdy.c                      |  2 +-
 epan/dissectors/packet-tls-utils.c                 |  6 ++--
 epan/dissectors/packet-tpm20.c                     |  2 +-
 epan/dissectors/packet-umts_rlc.c                  |  4 +--
 epan/dissectors/packet-wsp.c                       |  2 +-
 plugins/epan/profinet/packet-dcerpc-pn-io.c        |  2 +-
 plugins/epan/profinet/packet-dcom-cba-acco.c       | 12 ++++----
 37 files changed, 103 insertions(+), 103 deletions(-)