summaryrefslogtreecommitdiff
path: root/gdhcp
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-07-25 11:56:38 -0700
committerMarcel Holtmann <marcel@holtmann.org>2010-07-25 11:56:38 -0700
commitc4fd43a4ca1de3665407abe852a9a81ecdb1dd88 (patch)
treee6fa74a733d4cc79f1e7f2016f222aba171d876d /gdhcp
parent4faa2bedac24a8332f007f3f90219a156ccd444f (diff)
downloadconnman-c4fd43a4ca1de3665407abe852a9a81ecdb1dd88.tar.gz
connman-c4fd43a4ca1de3665407abe852a9a81ecdb1dd88.tar.bz2
connman-c4fd43a4ca1de3665407abe852a9a81ecdb1dd88.zip
Fix wrong prototype for DHCP client library reference counting
Diffstat (limited to 'gdhcp')
-rw-r--r--gdhcp/client.c13
-rw-r--r--gdhcp/gdhcp.h2
2 files changed, 13 insertions, 2 deletions
diff --git a/gdhcp/client.c b/gdhcp/client.c
index 7be3d3d7..2e9fe6f0 100644
--- a/gdhcp/client.c
+++ b/gdhcp/client.c
@@ -1204,13 +1204,21 @@ GDHCPClientError g_dhcp_client_set_send(GDHCPClient *dhcp_client,
return G_DHCP_CLIENT_ERROR_NONE;
}
-void g_dhcp_client_ref(GDHCPClient *dhcp_client)
+GDHCPClient *g_dhcp_client_ref(GDHCPClient *dhcp_client)
{
+ if (dhcp_client == NULL)
+ return NULL;
+
g_atomic_int_inc(&dhcp_client->ref_count);
+
+ return dhcp_client;
}
void g_dhcp_client_unref(GDHCPClient *dhcp_client)
{
+ if (dhcp_client == NULL)
+ return;
+
if (g_atomic_int_dec_and_test(&dhcp_client->ref_count) == FALSE)
return;
@@ -1231,6 +1239,9 @@ void g_dhcp_client_unref(GDHCPClient *dhcp_client)
void g_dhcp_client_set_debug(GDHCPClient *dhcp_client,
GDHCPDebugFunc func, gpointer data)
{
+ if (dhcp_client == NULL)
+ return;
+
dhcp_client->debug_func = func;
dhcp_client->debug_data = data;
}
diff --git a/gdhcp/gdhcp.h b/gdhcp/gdhcp.h
index b18300fc..6111ecb7 100644
--- a/gdhcp/gdhcp.h
+++ b/gdhcp/gdhcp.h
@@ -71,7 +71,7 @@ GDHCPClient *g_dhcp_client_new(GDHCPType type, int index,
int g_dhcp_client_start(GDHCPClient *client);
void g_dhcp_client_stop(GDHCPClient *client);
-void g_dhcp_client_ref(GDHCPClient *client);
+GDHCPClient *g_dhcp_client_ref(GDHCPClient *client);
void g_dhcp_client_unref(GDHCPClient *client);
void g_dhcp_client_register_event(GDHCPClient *client,