Wireshark-commits: [Wireshark-commits] master-2.6 2452d12: Clean up some issues with get_iface_list

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Sun, 03 May 2020 21:05:59 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=2452d12e5a562137d0e8ef61f570de896a0b45ac
Submitter: "Guy Harris <gharris@xxxxxxxxx>"
Changed: branch: master-2.6
Repository: wireshark

Commits:

2452d12 by Guy Harris (guy@xxxxxxxxxxxx):

    Clean up some issues with get_iface_list_string().
    
    Remove an assignment of NULL to a variable when it's in a branch of code
    where the variable's already known to be NULL.  Found by PVS-Studio.
    
    Pull get_display_name_for_interface() into the one place it's used.
    That:
    
        allows us to eliminate a test as, inside the loop where it's called,
        the loop index is what's passed to it, and the loop tests whether
        it's in range, so the test will never fail;
    
        means we just set interface_opts once, for both of the places it's
        used.
    
    Then we fix that code so that it sets interface_opts->descr to a
    generated descriptive name if it *is* null, rather than if it's *not*
    null.
    
    That should clean up some issues found by 1) PVS-Studio and 2) me.
    
    Change-Id: I4188ca8f5c7306477ef11117016691d1c9f0267f
    Reviewed-on: https://code.wireshark.org/review/37082
    Petri-Dish: Guy Harris <gharris@xxxxxxxxx>
    Tested-by: Petri Dish Buildbot
    Reviewed-by: Guy Harris <gharris@xxxxxxxxx>
    (backported from commit bd963200cef84df076af8e8b169fc9af0edbd2d8)
    Reviewed-on: https://code.wireshark.org/review/37085
    

Actions performed:

    from  174a7aa   pcapng: show some fields in decimal, not hexadecimal.
     add  2452d12   Clean up some issues with get_iface_list_string().


Summary of changes:
 ui/capture_ui_utils.c | 36 ++++++++++--------------------------
 1 file changed, 10 insertions(+), 26 deletions(-)