From 3f31a9593b21dd08b5f4469f9ff88dc12dbfb63d Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 13 Sep 2010 17:06:18 +0200 Subject: libmount: rewrite DBG() macro Signed-off-by: Karel Zak --- shlibs/mount/src/cache.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'shlibs/mount/src/cache.c') diff --git a/shlibs/mount/src/cache.c b/shlibs/mount/src/cache.c index 7e5c4afeb..a341efd4f 100644 --- a/shlibs/mount/src/cache.c +++ b/shlibs/mount/src/cache.c @@ -69,7 +69,11 @@ struct _mnt_cache { */ mnt_cache *mnt_new_cache(void) { - return calloc(1, sizeof(struct _mnt_cache)); + mnt_cache *cache = calloc(1, sizeof(struct _mnt_cache)); + if (!cache) + return NULL; + DBG(CACHE, mnt_debug_h(cache, "alloc")); + return cache; } /** @@ -84,6 +88,9 @@ void mnt_free_cache(mnt_cache *cache) if (!cache) return; + + DBG(CACHE, mnt_debug_h(cache, "free")); + for (i = 0; i < cache->nents; i++) { struct mnt_cache_entry *e = &cache->ents[i]; if (e->real != e->native) @@ -122,8 +129,7 @@ static int mnt_cache_add_entry(mnt_cache *cache, char *native, e->flag = flag; cache->nents++; - DBG(DEBUG_CACHE, - printf("cache: add entry[%2zd] (%s): %s: %s\n", + DBG(CACHE, mnt_debug_h(cache, "add entry [%2zd] (%s): %s: %s", cache->nents, (flag & MNT_CACHE_ISPATH) ? "path" : "tag", real, native)); @@ -249,7 +255,7 @@ int mnt_cache_read_tags(mnt_cache *cache, const char *devname) if (!cache || !devname) return -EINVAL; - DBG(DEBUG_CACHE, printf("cache: tags for %s requested\n", devname)); + DBG(CACHE, mnt_debug_h(cache, "tags for %s requested", devname)); /* check is device is already cached */ for (i = 0; i < cache->nents; i++) { @@ -261,8 +267,7 @@ int mnt_cache_read_tags(mnt_cache *cache, const char *devname) return 0; } - DBG(DEBUG_CACHE, - printf("cache: reading tags for: %s\n", devname)); + DBG(CACHE, mnt_debug_h(cache, "reading tags for: %s", devname)); pr = blkid_new_probe_from_filename(devname); if (!pr) -- cgit v1.2.3-55-g7522