diff options
-rw-r--r-- | libnm/nm-access-point.c | 2 | ||||
-rw-r--r-- | libnm/nm-active-connection.c | 6 | ||||
-rw-r--r-- | libnm/nm-device-bond.c | 2 | ||||
-rw-r--r-- | libnm/nm-device-bridge.c | 2 | ||||
-rw-r--r-- | libnm/nm-device-bt.c | 2 | ||||
-rw-r--r-- | libnm/nm-device-dummy.c | 2 | ||||
-rw-r--r-- | libnm/nm-device-ethernet.c | 4 | ||||
-rw-r--r-- | libnm/nm-device-generic.c | 4 | ||||
-rw-r--r-- | libnm/nm-device-infiniband.c | 2 | ||||
-rw-r--r-- | libnm/nm-device-ip-tunnel.c | 8 | ||||
-rw-r--r-- | libnm/nm-device-macvlan.c | 2 | ||||
-rw-r--r-- | libnm/nm-device-olpc-mesh.c | 2 | ||||
-rw-r--r-- | libnm/nm-device-team.c | 4 | ||||
-rw-r--r-- | libnm/nm-device-tun.c | 4 | ||||
-rw-r--r-- | libnm/nm-device-vlan.c | 2 | ||||
-rw-r--r-- | libnm/nm-device-vxlan.c | 6 | ||||
-rw-r--r-- | libnm/nm-device-wifi-p2p.c | 2 | ||||
-rw-r--r-- | libnm/nm-device-wifi.c | 4 | ||||
-rw-r--r-- | libnm/nm-device-wpan.c | 2 | ||||
-rw-r--r-- | libnm/nm-device.c | 18 | ||||
-rw-r--r-- | libnm/nm-ip-config.c | 2 | ||||
-rw-r--r-- | libnm/nm-libnm-utils.h | 31 | ||||
-rw-r--r-- | libnm/nm-manager.c | 2 | ||||
-rw-r--r-- | libnm/nm-vpn-connection.c | 2 |
24 files changed, 74 insertions, 43 deletions
diff --git a/libnm/nm-access-point.c b/libnm/nm-access-point.c index 58def0368c..d21bb60acc 100644 --- a/libnm/nm-access-point.c +++ b/libnm/nm-access-point.c @@ -163,7 +163,7 @@ nm_access_point_get_bssid (NMAccessPoint *ap) { g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NULL); - return nm_str_not_empty (NM_ACCESS_POINT_GET_PRIVATE (ap)->bssid); + return _nml_coerce_property_str_not_empty (NM_ACCESS_POINT_GET_PRIVATE (ap)->bssid); } /** diff --git a/libnm/nm-active-connection.c b/libnm/nm-active-connection.c index c52c2cf54d..6b49f9a5e0 100644 --- a/libnm/nm-active-connection.c +++ b/libnm/nm-active-connection.c @@ -109,7 +109,7 @@ nm_active_connection_get_id (NMActiveConnection *connection) { g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL); - return nm_str_not_empty (NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->id); + return _nml_coerce_property_str_not_empty (NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->id); } /** @@ -126,7 +126,7 @@ nm_active_connection_get_uuid (NMActiveConnection *connection) { g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL); - return nm_str_not_empty (NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->uuid); + return _nml_coerce_property_str_not_empty (NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->uuid); } /** @@ -143,7 +143,7 @@ nm_active_connection_get_connection_type (NMActiveConnection *connection) { g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL); - return nm_str_not_empty (NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->type); + return _nml_coerce_property_str_not_empty (NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->type); } /** diff --git a/libnm/nm-device-bond.c b/libnm/nm-device-bond.c index b62d829b57..880c4f94b8 100644 --- a/libnm/nm-device-bond.c +++ b/libnm/nm-device-bond.c @@ -56,7 +56,7 @@ nm_device_bond_get_hw_address (NMDeviceBond *device) { g_return_val_if_fail (NM_IS_DEVICE_BOND (device), NULL); - return nm_str_not_empty (NM_DEVICE_BOND_GET_PRIVATE (device)->hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_BOND_GET_PRIVATE (device)->hw_address); } /** diff --git a/libnm/nm-device-bridge.c b/libnm/nm-device-bridge.c index c4fc6e557b..8c3db03e9c 100644 --- a/libnm/nm-device-bridge.c +++ b/libnm/nm-device-bridge.c @@ -56,7 +56,7 @@ nm_device_bridge_get_hw_address (NMDeviceBridge *device) { g_return_val_if_fail (NM_IS_DEVICE_BRIDGE (device), NULL); - return nm_str_not_empty (NM_DEVICE_BRIDGE_GET_PRIVATE (device)->hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_BRIDGE_GET_PRIVATE (device)->hw_address); } /** diff --git a/libnm/nm-device-bt.c b/libnm/nm-device-bt.c index e3d9d4559f..d1600a4277 100644 --- a/libnm/nm-device-bt.c +++ b/libnm/nm-device-bt.c @@ -57,7 +57,7 @@ nm_device_bt_get_hw_address (NMDeviceBt *device) { g_return_val_if_fail (NM_IS_DEVICE_BT (device), NULL); - return nm_str_not_empty (NM_DEVICE_BT_GET_PRIVATE (device)->hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_BT_GET_PRIVATE (device)->hw_address); } /** diff --git a/libnm/nm-device-dummy.c b/libnm/nm-device-dummy.c index 7a56d53b99..a7f375fdf1 100644 --- a/libnm/nm-device-dummy.c +++ b/libnm/nm-device-dummy.c @@ -52,7 +52,7 @@ nm_device_dummy_get_hw_address (NMDeviceDummy *device) { g_return_val_if_fail (NM_IS_DEVICE_DUMMY (device), NULL); - return nm_str_not_empty (NM_DEVICE_DUMMY_GET_PRIVATE (device)->hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_DUMMY_GET_PRIVATE (device)->hw_address); } static gboolean diff --git a/libnm/nm-device-ethernet.c b/libnm/nm-device-ethernet.c index 28d3a1076a..94ec318ed6 100644 --- a/libnm/nm-device-ethernet.c +++ b/libnm/nm-device-ethernet.c @@ -61,7 +61,7 @@ nm_device_ethernet_get_hw_address (NMDeviceEthernet *device) { g_return_val_if_fail (NM_IS_DEVICE_ETHERNET (device), NULL); - return nm_str_not_empty (NM_DEVICE_ETHERNET_GET_PRIVATE (device)->hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_ETHERNET_GET_PRIVATE (device)->hw_address); } /** @@ -78,7 +78,7 @@ nm_device_ethernet_get_permanent_hw_address (NMDeviceEthernet *device) { g_return_val_if_fail (NM_IS_DEVICE_ETHERNET (device), NULL); - return nm_str_not_empty (NM_DEVICE_ETHERNET_GET_PRIVATE (device)->perm_hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_ETHERNET_GET_PRIVATE (device)->perm_hw_address); } /** diff --git a/libnm/nm-device-generic.c b/libnm/nm-device-generic.c index cdc92351a0..f8c4d25737 100644 --- a/libnm/nm-device-generic.c +++ b/libnm/nm-device-generic.c @@ -52,7 +52,7 @@ nm_device_generic_get_hw_address (NMDeviceGeneric *device) { g_return_val_if_fail (NM_IS_DEVICE_GENERIC (device), NULL); - return nm_str_not_empty (NM_DEVICE_GENERIC_GET_PRIVATE (device)->hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_GENERIC_GET_PRIVATE (device)->hw_address); } /*****************************************************************************/ @@ -62,7 +62,7 @@ get_type_description (NMDevice *device) { NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (device); - return nm_str_not_empty (priv->type_description); + return _nml_coerce_property_str_not_empty (priv->type_description); } static const char * diff --git a/libnm/nm-device-infiniband.c b/libnm/nm-device-infiniband.c index 5c750e7ac7..b48431a91c 100644 --- a/libnm/nm-device-infiniband.c +++ b/libnm/nm-device-infiniband.c @@ -53,7 +53,7 @@ nm_device_infiniband_get_hw_address (NMDeviceInfiniband *device) { g_return_val_if_fail (NM_IS_DEVICE_INFINIBAND (device), NULL); - return nm_str_not_empty (NM_DEVICE_INFINIBAND_GET_PRIVATE (device)->hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_INFINIBAND_GET_PRIVATE (device)->hw_address); } /** diff --git a/libnm/nm-device-ip-tunnel.c b/libnm/nm-device-ip-tunnel.c index 2f38071ace..3408dd28f0 100644 --- a/libnm/nm-device-ip-tunnel.c +++ b/libnm/nm-device-ip-tunnel.c @@ -105,7 +105,7 @@ nm_device_ip_tunnel_get_local (NMDeviceIPTunnel *device) { g_return_val_if_fail (NM_IS_DEVICE_IP_TUNNEL (device), NULL); - return nm_str_not_empty (NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->local); + return _nml_coerce_property_str_not_empty (NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->local); } /** @@ -121,7 +121,7 @@ nm_device_ip_tunnel_get_remote (NMDeviceIPTunnel *device) { g_return_val_if_fail (NM_IS_DEVICE_IP_TUNNEL (device), NULL); - return nm_str_not_empty (NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->remote); + return _nml_coerce_property_str_not_empty (NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->remote); } /** @@ -186,7 +186,7 @@ nm_device_ip_tunnel_get_input_key (NMDeviceIPTunnel *device) { g_return_val_if_fail (NM_IS_DEVICE_IP_TUNNEL (device), NULL); - return nm_str_not_empty (NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->input_key); + return _nml_coerce_property_str_not_empty (NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->input_key); } /** @@ -202,7 +202,7 @@ nm_device_ip_tunnel_get_output_key (NMDeviceIPTunnel *device) { g_return_val_if_fail (NM_IS_DEVICE_IP_TUNNEL (device), NULL); - return nm_str_not_empty (NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->output_key); + return _nml_coerce_property_str_not_empty (NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->output_key); } /** diff --git a/libnm/nm-device-macvlan.c b/libnm/nm-device-macvlan.c index d511b0b65c..59565b64a1 100644 --- a/libnm/nm-device-macvlan.c +++ b/libnm/nm-device-macvlan.c @@ -77,7 +77,7 @@ nm_device_macvlan_get_mode (NMDeviceMacvlan *device) { g_return_val_if_fail (NM_IS_DEVICE_MACVLAN (device), NULL); - return nm_str_not_empty (NM_DEVICE_MACVLAN_GET_PRIVATE (device)->mode); + return _nml_coerce_property_str_not_empty (NM_DEVICE_MACVLAN_GET_PRIVATE (device)->mode); } /** diff --git a/libnm/nm-device-olpc-mesh.c b/libnm/nm-device-olpc-mesh.c index 367580bbbd..4d81abcc53 100644 --- a/libnm/nm-device-olpc-mesh.c +++ b/libnm/nm-device-olpc-mesh.c @@ -55,7 +55,7 @@ nm_device_olpc_mesh_get_hw_address (NMDeviceOlpcMesh *device) { g_return_val_if_fail (NM_IS_DEVICE_OLPC_MESH (device), NULL); - return nm_str_not_empty (NM_DEVICE_OLPC_MESH_GET_PRIVATE (device)->hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_OLPC_MESH_GET_PRIVATE (device)->hw_address); } /** diff --git a/libnm/nm-device-team.c b/libnm/nm-device-team.c index 49c3aad2d8..08b3b082c1 100644 --- a/libnm/nm-device-team.c +++ b/libnm/nm-device-team.c @@ -58,7 +58,7 @@ nm_device_team_get_hw_address (NMDeviceTeam *device) { g_return_val_if_fail (NM_IS_DEVICE_TEAM (device), NULL); - return nm_str_not_empty (NM_DEVICE_TEAM_GET_PRIVATE (device)->hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_TEAM_GET_PRIVATE (device)->hw_address); } /** @@ -111,7 +111,7 @@ nm_device_team_get_config (NMDeviceTeam *device) { g_return_val_if_fail (NM_IS_DEVICE_TEAM (device), NULL); - return nm_str_not_empty (NM_DEVICE_TEAM_GET_PRIVATE (device)->config); + return _nml_coerce_property_str_not_empty (NM_DEVICE_TEAM_GET_PRIVATE (device)->config); } static const char * diff --git a/libnm/nm-device-tun.c b/libnm/nm-device-tun.c index e3b36d767e..220c9a2980 100644 --- a/libnm/nm-device-tun.c +++ b/libnm/nm-device-tun.c @@ -67,7 +67,7 @@ nm_device_tun_get_hw_address (NMDeviceTun *device) { g_return_val_if_fail (NM_IS_DEVICE_TUN (device), NULL); - return nm_str_not_empty (NM_DEVICE_TUN_GET_PRIVATE (device)->hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_TUN_GET_PRIVATE (device)->hw_address); } /** @@ -85,7 +85,7 @@ nm_device_tun_get_mode (NMDeviceTun *device) { g_return_val_if_fail (NM_IS_DEVICE_TUN (device), NULL); - return nm_str_not_empty (NM_DEVICE_TUN_GET_PRIVATE (device)->mode); + return _nml_coerce_property_str_not_empty (NM_DEVICE_TUN_GET_PRIVATE (device)->mode); } /** diff --git a/libnm/nm-device-vlan.c b/libnm/nm-device-vlan.c index 323d5b30e6..ebe9f00cbe 100644 --- a/libnm/nm-device-vlan.c +++ b/libnm/nm-device-vlan.c @@ -58,7 +58,7 @@ nm_device_vlan_get_hw_address (NMDeviceVlan *device) { g_return_val_if_fail (NM_IS_DEVICE_VLAN (device), NULL); - return nm_str_not_empty (NM_DEVICE_VLAN_GET_PRIVATE (device)->hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_VLAN_GET_PRIVATE (device)->hw_address); } /** diff --git a/libnm/nm-device-vxlan.c b/libnm/nm-device-vxlan.c index f63e1bdf57..27d7db1d7e 100644 --- a/libnm/nm-device-vxlan.c +++ b/libnm/nm-device-vxlan.c @@ -86,7 +86,7 @@ nm_device_vxlan_get_hw_address (NMDeviceVxlan *device) { g_return_val_if_fail (NM_IS_DEVICE_VXLAN (device), NULL); - return nm_str_not_empty (NM_DEVICE_VXLAN_GET_PRIVATE (device)->hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_VXLAN_GET_PRIVATE (device)->hw_address); } /** @@ -156,7 +156,7 @@ nm_device_vxlan_get_group (NMDeviceVxlan *device) { g_return_val_if_fail (NM_IS_DEVICE_VXLAN (device), NULL); - return nm_str_not_empty (NM_DEVICE_VXLAN_GET_PRIVATE (device)->group); + return _nml_coerce_property_str_not_empty (NM_DEVICE_VXLAN_GET_PRIVATE (device)->group); } /** @@ -172,7 +172,7 @@ nm_device_vxlan_get_local (NMDeviceVxlan *device) { g_return_val_if_fail (NM_IS_DEVICE_VXLAN (device), NULL); - return nm_str_not_empty (NM_DEVICE_VXLAN_GET_PRIVATE (device)->local); + return _nml_coerce_property_str_not_empty (NM_DEVICE_VXLAN_GET_PRIVATE (device)->local); } /** diff --git a/libnm/nm-device-wifi-p2p.c b/libnm/nm-device-wifi-p2p.c index c4fc142c55..92652b3841 100644 --- a/libnm/nm-device-wifi-p2p.c +++ b/libnm/nm-device-wifi-p2p.c @@ -73,7 +73,7 @@ nm_device_wifi_p2p_get_hw_address (NMDeviceWifiP2P *device) { g_return_val_if_fail (NM_IS_DEVICE_WIFI_P2P (device), NULL); - return nm_str_not_empty (NM_DEVICE_WIFI_P2P_GET_PRIVATE (device)->hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_WIFI_P2P_GET_PRIVATE (device)->hw_address); } /** diff --git a/libnm/nm-device-wifi.c b/libnm/nm-device-wifi.c index d358256060..36b26561c2 100644 --- a/libnm/nm-device-wifi.c +++ b/libnm/nm-device-wifi.c @@ -92,7 +92,7 @@ nm_device_wifi_get_hw_address (NMDeviceWifi *device) { g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), NULL); - return nm_str_not_empty (NM_DEVICE_WIFI_GET_PRIVATE (device)->hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_WIFI_GET_PRIVATE (device)->hw_address); } /** @@ -109,7 +109,7 @@ nm_device_wifi_get_permanent_hw_address (NMDeviceWifi *device) { g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), NULL); - return nm_str_not_empty (NM_DEVICE_WIFI_GET_PRIVATE (device)->perm_hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_WIFI_GET_PRIVATE (device)->perm_hw_address); } /** diff --git a/libnm/nm-device-wpan.c b/libnm/nm-device-wpan.c index 24d16faf13..3dfa8f267c 100644 --- a/libnm/nm-device-wpan.c +++ b/libnm/nm-device-wpan.c @@ -50,7 +50,7 @@ nm_device_wpan_get_hw_address (NMDeviceWpan *device) { g_return_val_if_fail (NM_IS_DEVICE_WPAN (device), NULL); - return nm_str_not_empty (NM_DEVICE_WPAN_GET_PRIVATE (device)->hw_address); + return _nml_coerce_property_str_not_empty (NM_DEVICE_WPAN_GET_PRIVATE (device)->hw_address); } static gboolean diff --git a/libnm/nm-device.c b/libnm/nm-device.c index 51139bfceb..96698967b9 100644 --- a/libnm/nm-device.c +++ b/libnm/nm-device.c @@ -860,7 +860,7 @@ nm_device_get_iface (NMDevice *device) { g_return_val_if_fail (NM_IS_DEVICE (device), NULL); - return nm_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->iface); + return _nml_coerce_property_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->iface); } /** @@ -878,7 +878,7 @@ nm_device_get_ip_iface (NMDevice *device) { g_return_val_if_fail (NM_IS_DEVICE (device), NULL); - return nm_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->ip_iface); + return _nml_coerce_property_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->ip_iface); } /** @@ -912,7 +912,7 @@ nm_device_get_udi (NMDevice *device) { g_return_val_if_fail (NM_IS_DEVICE (device), NULL); - return nm_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->udi); + return _nml_coerce_property_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->udi); } /** @@ -929,7 +929,7 @@ nm_device_get_driver (NMDevice *device) { g_return_val_if_fail (NM_IS_DEVICE (device), NULL); - return nm_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->driver); + return _nml_coerce_property_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->driver); } /** @@ -946,7 +946,7 @@ nm_device_get_driver_version (NMDevice *device) { g_return_val_if_fail (NM_IS_DEVICE (device), NULL); - return nm_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->driver_version); + return _nml_coerce_property_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->driver_version); } /** @@ -963,7 +963,7 @@ nm_device_get_firmware_version (NMDevice *device) { g_return_val_if_fail (NM_IS_DEVICE (device), NULL); - return nm_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->firmware_version); + return _nml_coerce_property_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->firmware_version); } /** @@ -988,7 +988,7 @@ nm_device_get_type_description (NMDevice *device) g_return_val_if_fail (NM_IS_DEVICE (device), NULL); if (priv->type_description) - return nm_str_not_empty (priv->type_description); + return _nml_coerce_property_str_not_empty (priv->type_description); if (NM_DEVICE_GET_CLASS (device)->get_type_description) { desc = NM_DEVICE_GET_CLASS (device)->get_type_description (device); @@ -1001,7 +1001,7 @@ nm_device_get_type_description (NMDevice *device) typename += 8; priv->type_description = g_ascii_strdown (typename, -1); - return nm_str_not_empty (priv->type_description); + return _nml_coerce_property_str_not_empty (priv->type_description); } /** @@ -1861,7 +1861,7 @@ nm_device_get_physical_port_id (NMDevice *device) { g_return_val_if_fail (NM_IS_DEVICE (device), NULL); - return nm_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->physical_port_id); + return _nml_coerce_property_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->physical_port_id); } /** diff --git a/libnm/nm-ip-config.c b/libnm/nm-ip-config.c index bc313bb327..19e008ed05 100644 --- a/libnm/nm-ip-config.c +++ b/libnm/nm-ip-config.c @@ -377,7 +377,7 @@ nm_ip_config_get_gateway (NMIPConfig *config) { g_return_val_if_fail (NM_IS_IP_CONFIG (config), NULL); - return nm_str_not_empty (NM_IP_CONFIG_GET_PRIVATE (config)->gateway); + return _nml_coerce_property_str_not_empty (NM_IP_CONFIG_GET_PRIVATE (config)->gateway); } /** diff --git a/libnm/nm-libnm-utils.h b/libnm/nm-libnm-utils.h index 2e0c792aba..39b86aac64 100644 --- a/libnm/nm-libnm-utils.h +++ b/libnm/nm-libnm-utils.h @@ -7,6 +7,7 @@ #define __NM_LIBNM_UTILS_H__ #include "nm-types.h" +#include "nm-glib-aux/nm-ref-string.h" /*****************************************************************************/ @@ -106,6 +107,36 @@ void _nml_dbus_log (NMLDBusLogLevel level, /*****************************************************************************/ +static inline const char * +_nml_coerce_property_str_not_null (const char *str) +{ + return str ?: ""; +} + +static inline const char * +_nml_coerce_property_str_not_empty (const char *str) +{ + return str && str[0] ? str : NULL; +} + +static inline const char * +_nml_coerce_property_object_path (NMRefString *path) +{ + if (!path) + return NULL; + if (nm_streq (path->str, "/")) + return NULL; + return path->str; +} + +static inline const char *const* +_nml_coerce_property_strv_not_null (char **strv) +{ + return ((const char *const*) strv) ?: NM_PTRARRAY_EMPTY (const char *); +} + +/*****************************************************************************/ + char *nm_utils_wincaps_to_dash (const char *caps); /*****************************************************************************/ diff --git a/libnm/nm-manager.c b/libnm/nm-manager.c index 10fb4a18b6..872c9fa8b9 100644 --- a/libnm/nm-manager.c +++ b/libnm/nm-manager.c @@ -436,7 +436,7 @@ nm_manager_get_version (NMManager *manager) { g_return_val_if_fail (NM_IS_MANAGER (manager), NULL); - return nm_str_not_empty (NM_MANAGER_GET_PRIVATE (manager)->version); + return _nml_coerce_property_str_not_empty (NM_MANAGER_GET_PRIVATE (manager)->version); } NMState diff --git a/libnm/nm-vpn-connection.c b/libnm/nm-vpn-connection.c index 3927397e31..a0d673e913 100644 --- a/libnm/nm-vpn-connection.c +++ b/libnm/nm-vpn-connection.c @@ -67,7 +67,7 @@ nm_vpn_connection_get_banner (NMVpnConnection *vpn) { g_return_val_if_fail (NM_IS_VPN_CONNECTION (vpn), NULL); - return nm_str_not_empty (NM_VPN_CONNECTION_GET_PRIVATE (vpn)->banner); + return _nml_coerce_property_str_not_empty (NM_VPN_CONNECTION_GET_PRIVATE (vpn)->banner); } /** |