build: fix return types (bgo #644665)

Some functions were returning FALSE or 0 instead of NULL.
This commit is contained in:
Kjartan Maraas 2011-03-14 01:05:51 -05:00 committed by Dan Williams
parent 6d0d302916
commit c2b4b9c1d7
17 changed files with 25 additions and 25 deletions

View file

@ -434,9 +434,9 @@ nm_access_point_filter_connections (NMAccessPoint *ap, const GSList *connections
setting_mode = nm_setting_wireless_get_mode (s_wifi);
if (setting_mode && ap_mode) {
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))
return FALSE;
return NULL;
}
/* Band and Channel/Frequency */

View file

@ -329,7 +329,7 @@ nm_ip4_config_get_addresses (NMIP4Config *config)
NMIP4ConfigPrivate *priv;
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);
if (priv->addresses)
@ -479,7 +479,7 @@ nm_ip4_config_get_routes (NMIP4Config *config)
NMIP4ConfigPrivate *priv;
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);
if (priv->routes)

View file

@ -156,7 +156,7 @@ nm_ip6_config_get_addresses (NMIP6Config *config)
NMIP6ConfigPrivate *priv;
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);
if (priv->addresses)
@ -266,7 +266,7 @@ nm_ip6_config_get_routes (NMIP6Config *config)
NMIP6ConfigPrivate *priv;
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);
if (priv->routes)

View file

@ -1091,7 +1091,7 @@ nm_connection_new_from_hash (GHashTable *hash, GError **error)
g_return_val_if_fail (hash != NULL, NULL);
if (!validate_permissions_type (hash, error))
return FALSE;
return NULL;
connection = nm_connection_new ();
g_hash_table_foreach (hash, parse_one_setting, connection);

View file

@ -415,7 +415,7 @@ nm_setting_ip4_config_get_ignore_auto_dns (NMSettingIP4Config *setting)
const char *
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;
}
@ -431,7 +431,7 @@ nm_setting_ip4_config_get_dhcp_send_hostname (NMSettingIP4Config *setting)
const char *
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;
}

View file

@ -353,7 +353,7 @@ create_dhclient_config (const char *iface,
GError *error = NULL;
gboolean success = FALSE;
g_return_val_if_fail (iface != NULL, FALSE);
g_return_val_if_fail (iface != NULL, NULL);
#if defined(TARGET_SUSE)
orig = g_strdup (SYSCONFDIR "/dhclient.conf");
@ -369,7 +369,7 @@ create_dhclient_config (const char *iface,
if (!orig) {
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)
@ -379,7 +379,7 @@ create_dhclient_config (const char *iface,
orig = g_strdup_printf (SYSCONFDIR "/dhcp/dhclient-%s.conf", iface);
if (!orig) {
nm_log_warn (LOGD_DHCP, "(%s): not enough memory for dhclient options.", iface);
return FALSE;
return NULL;
}
}
#endif

View file

@ -190,7 +190,7 @@ find_zone (GPtrArray *zones, const char *domain)
{
guint32 dhash, i;
g_return_val_if_fail (domain != NULL, FALSE);
g_return_val_if_fail (domain != NULL, NULL);
dhash = g_str_hash (domain);
for (i = 0; i < zones->len; i++) {

View file

@ -286,7 +286,7 @@ nm_act_request_get_default6 (NMActRequest *req)
GObject *
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);
}

View file

@ -2158,7 +2158,7 @@ supports_mii_carrier_detect (NMDeviceEthernet *self)
fd = socket (PF_INET, SOCK_DGRAM, 0);
if (fd < 0) {
nm_log_err (LOGD_HW, "couldn't open control socket.");
return 0;
return FALSE;
}
memset (&ifr, 0, sizeof (struct ifreq));

View file

@ -3874,7 +3874,7 @@ spec_match_list (NMDeviceInterface *device, const GSList *specs)
static NMConnection *
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)
return NM_DEVICE_GET_CLASS (device)->connection_match_config (NM_DEVICE (device), connections);

View file

@ -121,7 +121,7 @@ nm_ip4_config_export (NMIP4Config *config)
const char *
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;
}

View file

@ -114,7 +114,7 @@ nm_ip6_config_export (NMIP6Config *config)
const char *
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;
}

View file

@ -491,7 +491,7 @@ find_plugin (GSList *list, const char *pname)
GSList *iter;
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)) {
NMSystemConfigInterface *plugin = NM_SYSTEM_CONFIG_INTERFACE (iter->data);

View file

@ -152,8 +152,8 @@ nm_system_config_interface_add_connection (NMSystemConfigInterface *config,
NMConnection *connection,
GError **error)
{
g_return_val_if_fail (config != NULL, FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
g_return_val_if_fail (config != NULL, NULL);
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->add_connection)
return NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->add_connection (config, connection, error);

View file

@ -173,7 +173,7 @@ nm_ifcfg_connection_get_path (NMIfcfgConnection *self)
const char *
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;
}

View file

@ -465,7 +465,7 @@ plugin_get_hostname (SCPluginIfcfg *plugin)
network = svNewFile (SC_NETWORK_FILE);
if (!network) {
PLUGIN_WARN (IFCFG_PLUGIN_NAME, "Could not get hostname: failed to read " SC_NETWORK_FILE);
return FALSE;
return NULL;
}
hostname = svGetValue (network, "HOSTNAME", FALSE);

View file

@ -998,8 +998,8 @@ nm_supplicant_interface_get_object_path (NMSupplicantInterface *self)
const char *
nm_supplicant_interface_get_ifname (NMSupplicantInterface *self)
{
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (NM_IS_SUPPLICANT_INTERFACE (self), FALSE);
g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (NM_IS_SUPPLICANT_INTERFACE (self), NULL);
return NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self)->dev;
}