Skip to content
  • Thomas Haller's avatar
    cli: cleanup _get_fcn_vlan_xgress_priority_map() · f6237b3f
    Thomas Haller authored
    - merge the pointless helper function vlan_priorities_to_string()
      into the only caller _get_fcn_vlan_xgress_priority_map().
    
    - minor cleanups, like setting out-is-default if num==0, not
      based on whether we have a non-empty string. There is not difference
      in practice, because nm_setting_vlan_get_priority() never fails.
      Hence they are identical. But nm_setting_vlan_get_priority() has
      an API that allows it to fail, so we should declare the default
      depending on the number of vlan priorities.
    
    - don't allocate the temporary GString instance if we won't need it.
    
    - only append the delimiter if needed, and not truncate it afterwards.
      It might have even worse performance this way, but it feels more
      correct to me.
    
    - also cache the result of nm_setting_vlan_get_num_priorities().
      NMSettingVlan's implementation is horrible and uses a GSList to
      track the list of priorities. This makes it relatively expensive
      to call get-num-priorities repeatedly (and pointless).
    
    (cherry picked from commit bbfd3668)
    f6237b3f