Wireshark-commits: [Wireshark-commits] master bd96320: Clean up some issues with get_iface_list_str

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

Commits:

bd96320 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>
    

Actions performed:

    from  90fdb71   pcapng: show some fields in decimal, not hexadecimal.
     add  bd96320   Clean up some issues with get_iface_list_string().


Summary of changes:
 ui/capture_ui_utils.c | 43 +++++++++++++------------------------------
 1 file changed, 13 insertions(+), 30 deletions(-)