summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2011-03-17 15:40:39 (GMT)
committerThomas Graf <tgraf@suug.ch>2011-03-17 15:40:39 (GMT)
commit33e94038c45aec39024c7e47441c6b25b7a11a9b (patch)
treebc31d162253947fe26e92e85302dd9b15e535314
parent2c75886060ac145ac76b19d17a144a76ee801382 (diff)
downloadlibnl-33e94038c45aec39024c7e47441c6b25b7a11a9b.zip
libnl-33e94038c45aec39024c7e47441c6b25b7a11a9b.tar.gz
libnl-33e94038c45aec39024c7e47441c6b25b7a11a9b.tar.bz2
Print debugging info while iterating a cache based on a filter
-rw-r--r--lib/cache.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/cache.c b/lib/cache.c
index 2b24946..e0e845d 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -824,8 +824,15 @@ void nl_cache_foreach_filter(struct nl_cache *cache, struct nl_object *filter,
ops = cache->c_ops->co_obj_ops;
nl_list_for_each_entry_safe(obj, tmp, &cache->c_items, ce_list) {
- if (filter && !nl_object_match_filter(obj, filter))
- continue;
+ if (filter) {
+ int diff = nl_object_match_filter(obj, filter);
+
+ NL_DBG(3, "%p<->%p object difference: %x\n",
+ obj, filter, diff);
+
+ if (!diff)
+ continue;
+ }
cb(obj, arg);
}