From: Marcel Holtmann Date: Sun, 25 Jul 2010 18:56:38 +0000 (-0700) Subject: Fix wrong prototype for DHCP client library reference counting X-Git-Tag: 2.0_alpha~2625 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c4fd43a4ca1de3665407abe852a9a81ecdb1dd88;p=framework%2Fconnectivity%2Fconnman.git Fix wrong prototype for DHCP client library reference counting --- diff --git a/gdhcp/client.c b/gdhcp/client.c index 7be3d3d..2e9fe6f 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 b18300f..6111ecb 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,