summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/connman.h13
-rw-r--r--src/ipconfig.c13
2 files changed, 20 insertions, 6 deletions
diff --git a/src/connman.h b/src/connman.h
index c5803e11..158f51f0 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -198,8 +198,17 @@ struct connman_ipconfig_ops {
struct connman_ipconfig *__connman_ipconfig_create(int index,
enum connman_ipconfig_type type);
-struct connman_ipconfig *__connman_ipconfig_ref(struct connman_ipconfig *ipconfig);
-void __connman_ipconfig_unref(struct connman_ipconfig *ipconfig);
+
+#define __connman_ipconfig_ref(ipconfig) \
+ __connman_ipconfig_ref_debug(ipconfig, __FILE__, __LINE__, __func__)
+#define __connman_ipconfig_unref(ipconfig) \
+ __connman_ipconfig_unref_debug(ipconfig, __FILE__, __LINE__, __func__)
+
+struct connman_ipconfig *
+__connman_ipconfig_ref_debug(struct connman_ipconfig *ipconfig,
+ const char *file, int line, const char *caller);
+void __connman_ipconfig_unref_debug(struct connman_ipconfig *ipconfig,
+ const char *file, int line, const char *caller);
void *__connman_ipconfig_get_data(struct connman_ipconfig *ipconfig);
void __connman_ipconfig_set_data(struct connman_ipconfig *ipconfig, void *data);
diff --git a/src/ipconfig.c b/src/ipconfig.c
index 75cb56e5..34a8ddcb 100644
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -1297,9 +1297,12 @@ struct connman_ipconfig *__connman_ipconfig_create(int index,
*
* Increase reference counter of ipconfig
*/
-struct connman_ipconfig *__connman_ipconfig_ref(struct connman_ipconfig *ipconfig)
+struct connman_ipconfig *
+__connman_ipconfig_ref_debug(struct connman_ipconfig *ipconfig,
+ const char *file, int line, const char *caller)
{
- DBG("ipconfig %p refcount %d", ipconfig, ipconfig->refcount + 1);
+ DBG("%p ref %d by %s:%d:%s()", ipconfig, ipconfig->refcount + 1,
+ file, line, caller);
__sync_fetch_and_add(&ipconfig->refcount, 1);
@@ -1312,12 +1315,14 @@ struct connman_ipconfig *__connman_ipconfig_ref(struct connman_ipconfig *ipconfi
*
* Decrease reference counter of ipconfig
*/
-void __connman_ipconfig_unref(struct connman_ipconfig *ipconfig)
+void __connman_ipconfig_unref_debug(struct connman_ipconfig *ipconfig,
+ const char *file, int line, const char *caller)
{
if (ipconfig == NULL)
return;
- DBG("ipconfig %p refcount %d", ipconfig, ipconfig->refcount - 1);
+ DBG("%p ref %d by %s:%d:%s()", ipconfig, ipconfig->refcount - 1,
+ file, line, caller);
if (__sync_fetch_and_sub(&ipconfig->refcount, 1) != 1)
return;