diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2012-01-20 12:01:47 +0200 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2012-01-24 11:48:06 +0100 |
commit | 733d96f45e3ee0bcf9972079d803a266fdf9f725 (patch) | |
tree | f850fae2ba7a9f526d908d952b682326a53a9a27 | |
parent | 783da99f3668b165bd11929bc0c7aebbe7bcf752 (diff) | |
download | connman-733d96f45e3ee0bcf9972079d803a266fdf9f725.tar.gz connman-733d96f45e3ee0bcf9972079d803a266fdf9f725.tar.bz2 connman-733d96f45e3ee0bcf9972079d803a266fdf9f725.zip |
provider: Add caller information to ref/unref debug prints.
-rw-r--r-- | include/provider.h | 13 | ||||
-rw-r--r-- | src/provider.c | 13 |
2 files changed, 20 insertions, 6 deletions
diff --git a/include/provider.h b/include/provider.h index 8e9f859b..8b4d199b 100644 --- a/include/provider.h +++ b/include/provider.h @@ -59,8 +59,17 @@ enum connman_provider_error { struct connman_provider; struct connman_ipaddress; -struct connman_provider *connman_provider_ref(struct connman_provider *provider); -void connman_provider_unref(struct connman_provider *provider); +#define connman_provider_ref(provider) \ + connman_provider_ref_debug(provider, __FILE__, __LINE__, __func__) + +#define connman_provider_unref(provider) \ + connman_provider_unref_debug(provider, __FILE__, __LINE__, __func__) + +struct connman_provider * +connman_provider_ref_debug(struct connman_provider *provider, + const char *file, int line, const char *caller); +void connman_provider_unref_debug(struct connman_provider *provider, + const char *file, int line, const char *caller); int connman_provider_set_string(struct connman_provider *provider, const char *key, const char *value); diff --git a/src/provider.c b/src/provider.c index f0a91e87..ce3382d7 100644 --- a/src/provider.c +++ b/src/provider.c @@ -209,9 +209,12 @@ static void provider_unregister(struct connman_provider *provider) provider_remove(provider); } -struct connman_provider *connman_provider_ref(struct connman_provider *provider) +struct connman_provider * +connman_provider_ref_debug(struct connman_provider *provider, + const char *file, int line, const char *caller) { - DBG("provider %p refcount %d", provider, provider->refcount + 1); + DBG("%p ref %d by %s:%d:%s()", provider, provider->refcount + 1, + file, line, caller); __sync_fetch_and_add(&provider->refcount, 1); @@ -231,9 +234,11 @@ static void provider_destruct(struct connman_provider *provider) g_hash_table_destroy(provider->setting_strings); } -void connman_provider_unref(struct connman_provider *provider) +void connman_provider_unref_debug(struct connman_provider *provider, + const char *file, int line, const char *caller) { - DBG("provider %p refcount %d", provider, provider->refcount - 1); + DBG("%p ref %d by %s:%d:%s()", provider, provider->refcount - 1, + file, line, caller); if (__sync_fetch_and_sub(&provider->refcount, 1) != 1) return; |