mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-15 12:34:55 +00:00
build: fix return types (bgo #644665)
Some functions were returning FALSE or 0 instead of NULL.
This commit is contained in:
parent
6d0d302916
commit
c2b4b9c1d7
|
@ -434,9 +434,9 @@ nm_access_point_filter_connections (NMAccessPoint *ap, const GSList *connections
|
||||||
setting_mode = nm_setting_wireless_get_mode (s_wifi);
|
setting_mode = nm_setting_wireless_get_mode (s_wifi);
|
||||||
if (setting_mode && ap_mode) {
|
if (setting_mode && ap_mode) {
|
||||||
if (!strcmp (setting_mode, "infrastructure") && (ap_mode != NM_802_11_MODE_INFRA))
|
if (!strcmp (setting_mode, "infrastructure") && (ap_mode != NM_802_11_MODE_INFRA))
|
||||||
return FALSE;
|
return NULL;
|
||||||
if (!strcmp (setting_mode, "adhoc") && (ap_mode != NM_802_11_MODE_ADHOC))
|
if (!strcmp (setting_mode, "adhoc") && (ap_mode != NM_802_11_MODE_ADHOC))
|
||||||
return FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Band and Channel/Frequency */
|
/* Band and Channel/Frequency */
|
||||||
|
|
|
@ -329,7 +329,7 @@ nm_ip4_config_get_addresses (NMIP4Config *config)
|
||||||
NMIP4ConfigPrivate *priv;
|
NMIP4ConfigPrivate *priv;
|
||||||
GValue value = { 0, };
|
GValue value = { 0, };
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
||||||
|
|
||||||
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
||||||
if (priv->addresses)
|
if (priv->addresses)
|
||||||
|
@ -479,7 +479,7 @@ nm_ip4_config_get_routes (NMIP4Config *config)
|
||||||
NMIP4ConfigPrivate *priv;
|
NMIP4ConfigPrivate *priv;
|
||||||
GValue value = { 0, };
|
GValue value = { 0, };
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
||||||
|
|
||||||
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
||||||
if (priv->routes)
|
if (priv->routes)
|
||||||
|
|
|
@ -156,7 +156,7 @@ nm_ip6_config_get_addresses (NMIP6Config *config)
|
||||||
NMIP6ConfigPrivate *priv;
|
NMIP6ConfigPrivate *priv;
|
||||||
GValue value = { 0, };
|
GValue value = { 0, };
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_IP6_CONFIG (config), 0);
|
g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);
|
||||||
|
|
||||||
priv = NM_IP6_CONFIG_GET_PRIVATE (config);
|
priv = NM_IP6_CONFIG_GET_PRIVATE (config);
|
||||||
if (priv->addresses)
|
if (priv->addresses)
|
||||||
|
@ -266,7 +266,7 @@ nm_ip6_config_get_routes (NMIP6Config *config)
|
||||||
NMIP6ConfigPrivate *priv;
|
NMIP6ConfigPrivate *priv;
|
||||||
GValue value = { 0, };
|
GValue value = { 0, };
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_IP6_CONFIG (config), 0);
|
g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);
|
||||||
|
|
||||||
priv = NM_IP6_CONFIG_GET_PRIVATE (config);
|
priv = NM_IP6_CONFIG_GET_PRIVATE (config);
|
||||||
if (priv->routes)
|
if (priv->routes)
|
||||||
|
|
|
@ -1091,7 +1091,7 @@ nm_connection_new_from_hash (GHashTable *hash, GError **error)
|
||||||
g_return_val_if_fail (hash != NULL, NULL);
|
g_return_val_if_fail (hash != NULL, NULL);
|
||||||
|
|
||||||
if (!validate_permissions_type (hash, error))
|
if (!validate_permissions_type (hash, error))
|
||||||
return FALSE;
|
return NULL;
|
||||||
|
|
||||||
connection = nm_connection_new ();
|
connection = nm_connection_new ();
|
||||||
g_hash_table_foreach (hash, parse_one_setting, connection);
|
g_hash_table_foreach (hash, parse_one_setting, connection);
|
||||||
|
|
|
@ -415,7 +415,7 @@ nm_setting_ip4_config_get_ignore_auto_dns (NMSettingIP4Config *setting)
|
||||||
const char *
|
const char *
|
||||||
nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting)
|
nm_setting_ip4_config_get_dhcp_client_id (NMSettingIP4Config *setting)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE);
|
g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), NULL);
|
||||||
|
|
||||||
return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_client_id;
|
return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_client_id;
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,7 @@ nm_setting_ip4_config_get_dhcp_send_hostname (NMSettingIP4Config *setting)
|
||||||
const char *
|
const char *
|
||||||
nm_setting_ip4_config_get_dhcp_hostname (NMSettingIP4Config *setting)
|
nm_setting_ip4_config_get_dhcp_hostname (NMSettingIP4Config *setting)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), FALSE);
|
g_return_val_if_fail (NM_IS_SETTING_IP4_CONFIG (setting), NULL);
|
||||||
|
|
||||||
return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_hostname;
|
return NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting)->dhcp_hostname;
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,7 +353,7 @@ create_dhclient_config (const char *iface,
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
|
|
||||||
g_return_val_if_fail (iface != NULL, FALSE);
|
g_return_val_if_fail (iface != NULL, NULL);
|
||||||
|
|
||||||
#if defined(TARGET_SUSE)
|
#if defined(TARGET_SUSE)
|
||||||
orig = g_strdup (SYSCONFDIR "/dhclient.conf");
|
orig = g_strdup (SYSCONFDIR "/dhclient.conf");
|
||||||
|
@ -369,7 +369,7 @@ create_dhclient_config (const char *iface,
|
||||||
|
|
||||||
if (!orig) {
|
if (!orig) {
|
||||||
nm_log_warn (LOGD_DHCP, "(%s): not enough memory for dhclient options.", iface);
|
nm_log_warn (LOGD_DHCP, "(%s): not enough memory for dhclient options.", iface);
|
||||||
return FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(TARGET_SUSE) && !defined(TARGET_DEBIAN) && !defined(TARGET_GENTOO)
|
#if !defined(TARGET_SUSE) && !defined(TARGET_DEBIAN) && !defined(TARGET_GENTOO)
|
||||||
|
@ -379,7 +379,7 @@ create_dhclient_config (const char *iface,
|
||||||
orig = g_strdup_printf (SYSCONFDIR "/dhcp/dhclient-%s.conf", iface);
|
orig = g_strdup_printf (SYSCONFDIR "/dhcp/dhclient-%s.conf", iface);
|
||||||
if (!orig) {
|
if (!orig) {
|
||||||
nm_log_warn (LOGD_DHCP, "(%s): not enough memory for dhclient options.", iface);
|
nm_log_warn (LOGD_DHCP, "(%s): not enough memory for dhclient options.", iface);
|
||||||
return FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -190,7 +190,7 @@ find_zone (GPtrArray *zones, const char *domain)
|
||||||
{
|
{
|
||||||
guint32 dhash, i;
|
guint32 dhash, i;
|
||||||
|
|
||||||
g_return_val_if_fail (domain != NULL, FALSE);
|
g_return_val_if_fail (domain != NULL, NULL);
|
||||||
|
|
||||||
dhash = g_str_hash (domain);
|
dhash = g_str_hash (domain);
|
||||||
for (i = 0; i < zones->len; i++) {
|
for (i = 0; i < zones->len; i++) {
|
||||||
|
|
|
@ -286,7 +286,7 @@ nm_act_request_get_default6 (NMActRequest *req)
|
||||||
GObject *
|
GObject *
|
||||||
nm_act_request_get_device (NMActRequest *req)
|
nm_act_request_get_device (NMActRequest *req)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), FALSE);
|
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NULL);
|
||||||
|
|
||||||
return G_OBJECT (NM_ACT_REQUEST_GET_PRIVATE (req)->device);
|
return G_OBJECT (NM_ACT_REQUEST_GET_PRIVATE (req)->device);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2158,7 +2158,7 @@ supports_mii_carrier_detect (NMDeviceEthernet *self)
|
||||||
fd = socket (PF_INET, SOCK_DGRAM, 0);
|
fd = socket (PF_INET, SOCK_DGRAM, 0);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
nm_log_err (LOGD_HW, "couldn't open control socket.");
|
nm_log_err (LOGD_HW, "couldn't open control socket.");
|
||||||
return 0;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset (&ifr, 0, sizeof (struct ifreq));
|
memset (&ifr, 0, sizeof (struct ifreq));
|
||||||
|
|
|
@ -3874,7 +3874,7 @@ spec_match_list (NMDeviceInterface *device, const GSList *specs)
|
||||||
static NMConnection *
|
static NMConnection *
|
||||||
connection_match_config (NMDeviceInterface *device, const GSList *connections)
|
connection_match_config (NMDeviceInterface *device, const GSList *connections)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (device != NULL, FALSE);
|
g_return_val_if_fail (device != NULL, NULL);
|
||||||
|
|
||||||
if (NM_DEVICE_GET_CLASS (device)->connection_match_config)
|
if (NM_DEVICE_GET_CLASS (device)->connection_match_config)
|
||||||
return NM_DEVICE_GET_CLASS (device)->connection_match_config (NM_DEVICE (device), connections);
|
return NM_DEVICE_GET_CLASS (device)->connection_match_config (NM_DEVICE (device), connections);
|
||||||
|
|
|
@ -121,7 +121,7 @@ nm_ip4_config_export (NMIP4Config *config)
|
||||||
const char *
|
const char *
|
||||||
nm_ip4_config_get_dbus_path (NMIP4Config *config)
|
nm_ip4_config_get_dbus_path (NMIP4Config *config)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), FALSE);
|
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
||||||
|
|
||||||
return NM_IP4_CONFIG_GET_PRIVATE (config)->path;
|
return NM_IP4_CONFIG_GET_PRIVATE (config)->path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ nm_ip6_config_export (NMIP6Config *config)
|
||||||
const char *
|
const char *
|
||||||
nm_ip6_config_get_dbus_path (NMIP6Config *config)
|
nm_ip6_config_get_dbus_path (NMIP6Config *config)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (NM_IS_IP6_CONFIG (config), FALSE);
|
g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);
|
||||||
|
|
||||||
return NM_IP6_CONFIG_GET_PRIVATE (config)->path;
|
return NM_IP6_CONFIG_GET_PRIVATE (config)->path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -491,7 +491,7 @@ find_plugin (GSList *list, const char *pname)
|
||||||
GSList *iter;
|
GSList *iter;
|
||||||
GObject *obj = NULL;
|
GObject *obj = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (pname != NULL, FALSE);
|
g_return_val_if_fail (pname != NULL, NULL);
|
||||||
|
|
||||||
for (iter = list; iter && !obj; iter = g_slist_next (iter)) {
|
for (iter = list; iter && !obj; iter = g_slist_next (iter)) {
|
||||||
NMSystemConfigInterface *plugin = NM_SYSTEM_CONFIG_INTERFACE (iter->data);
|
NMSystemConfigInterface *plugin = NM_SYSTEM_CONFIG_INTERFACE (iter->data);
|
||||||
|
|
|
@ -152,8 +152,8 @@ nm_system_config_interface_add_connection (NMSystemConfigInterface *config,
|
||||||
NMConnection *connection,
|
NMConnection *connection,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (config != NULL, FALSE);
|
g_return_val_if_fail (config != NULL, NULL);
|
||||||
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
|
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
|
||||||
|
|
||||||
if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->add_connection)
|
if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->add_connection)
|
||||||
return NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->add_connection (config, connection, error);
|
return NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->add_connection (config, connection, error);
|
||||||
|
|
|
@ -173,7 +173,7 @@ nm_ifcfg_connection_get_path (NMIfcfgConnection *self)
|
||||||
const char *
|
const char *
|
||||||
nm_ifcfg_connection_get_unmanaged_spec (NMIfcfgConnection *self)
|
nm_ifcfg_connection_get_unmanaged_spec (NMIfcfgConnection *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (NM_IS_IFCFG_CONNECTION (self), FALSE);
|
g_return_val_if_fail (NM_IS_IFCFG_CONNECTION (self), NULL);
|
||||||
|
|
||||||
return NM_IFCFG_CONNECTION_GET_PRIVATE (self)->unmanaged;
|
return NM_IFCFG_CONNECTION_GET_PRIVATE (self)->unmanaged;
|
||||||
}
|
}
|
||||||
|
|
|
@ -465,7 +465,7 @@ plugin_get_hostname (SCPluginIfcfg *plugin)
|
||||||
network = svNewFile (SC_NETWORK_FILE);
|
network = svNewFile (SC_NETWORK_FILE);
|
||||||
if (!network) {
|
if (!network) {
|
||||||
PLUGIN_WARN (IFCFG_PLUGIN_NAME, "Could not get hostname: failed to read " SC_NETWORK_FILE);
|
PLUGIN_WARN (IFCFG_PLUGIN_NAME, "Could not get hostname: failed to read " SC_NETWORK_FILE);
|
||||||
return FALSE;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
hostname = svGetValue (network, "HOSTNAME", FALSE);
|
hostname = svGetValue (network, "HOSTNAME", FALSE);
|
||||||
|
|
|
@ -998,8 +998,8 @@ nm_supplicant_interface_get_object_path (NMSupplicantInterface *self)
|
||||||
const char *
|
const char *
|
||||||
nm_supplicant_interface_get_ifname (NMSupplicantInterface *self)
|
nm_supplicant_interface_get_ifname (NMSupplicantInterface *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (self != NULL, FALSE);
|
g_return_val_if_fail (self != NULL, NULL);
|
||||||
g_return_val_if_fail (NM_IS_SUPPLICANT_INTERFACE (self), FALSE);
|
g_return_val_if_fail (NM_IS_SUPPLICANT_INTERFACE (self), NULL);
|
||||||
|
|
||||||
return NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self)->dev;
|
return NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self)->dev;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue