summaryrefslogtreecommitdiffstats
path: root/__root__
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2015-03-19 18:02:31 +0100
committerJan Pokorný <jpokorny@redhat.com>2015-03-20 17:41:41 +0100
commit67477999b0a973d48c5d2d58c4c97fb9add336bb (patch)
treebd63ebd1560d3c73e034a6e5aacd3c3d94292fef /__root__
parent4f9ef88aec2f8e722f9b6a8749ebc64b269f16f1 (diff)
downloadclufter-67477999b0a973d48c5d2d58c4c97fb9add336bb.tar.gz
clufter-67477999b0a973d48c5d2d58c4c97fb9add336bb.tar.xz
clufter-67477999b0a973d48c5d2d58c4c97fb9add336bb.zip
ccs-flatten/list.h: list_do{,ne}: spare extra check
... that also makes this wrapped iteration more-or-less compatible with list_remove (see the in-line comment, but discretion needed, untested!) Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to '__root__')
-rw-r--r--__root__/ccs-flatten/list.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/__root__/ccs-flatten/list.h b/__root__/ccs-flatten/list.h
index 9613eb4..d77a2a0 100644
--- a/__root__/ccs-flatten/list.h
+++ b/__root__/ccs-flatten/list.h
@@ -55,13 +55,16 @@ do { \
/*
list_do(list, node) {
stuff; // redefining "node" (as well as "list) unsafe!
+ // NOTE: running list_remove(list, node) possible, but you have to call
+ // "if (list && (node = (void *)le(*list)->le_next)) continue;"
+ // afterwards (after node-related resources cleanup if needed)
} while (!list_done(list, node));
*/
# define list_do(list, curr) \
if ((curr = *list)) do
# define list_done(list, curr) \
- ((curr = (void *)le(curr)->le_next) && (curr == *list))
+ ((curr = (void *)le(curr)->le_next) == *list)
/*
* list_for(list, tmp, counter) {