]> granicus.if.org Git - libnl/commitdiff
Print debugging info while iterating a cache based on a filter
authorThomas Graf <tgraf@suug.ch>
Thu, 17 Mar 2011 15:40:39 +0000 (16:40 +0100)
committerThomas Graf <tgraf@suug.ch>
Thu, 17 Mar 2011 15:40:39 +0000 (16:40 +0100)
lib/cache.c

index 2b24946948a61c54103213cfe9a0409e1ba50dfc..e0e845ddc971c9866f410cd010610d424674da63 100644 (file)
@@ -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);
        }