[spice-server] red-common: Add a comment for GLIST_FOREACH_GENERIC

Submitted by Frediano Ziglio on July 8, 2019, 2:23 p.m.

Details

Message ID 20190708142349.21297-1-fziglio@redhat.com
State Accepted
Headers show
Series "red-common: Add a comment for GLIST_FOREACH_GENERIC" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio July 8, 2019, 2:23 p.m.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 server/red-common.h | 4 ++++
 1 file changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/server/red-common.h b/server/red-common.h
index 6b5d0b2e0..03efbdacb 100644
--- a/server/red-common.h
+++ b/server/red-common.h
@@ -79,6 +79,10 @@  typedef struct GListIter {
     GList *next;
 } GListIter;
 
+/* Iterate thougth a GList. Note that the iteration is "safe" meaning that the
+ * current item can be removed while the list is scanned. This is required as
+ * the code inside the loop in some cases can remove the element we are
+ * processing */
 #define GLIST_FOREACH_GENERIC(_list, _iter, _type, _data, _dir) \
     for (GListIter _iter = { .link = _list }; \
         (_data = (_type *) (_iter.link ? _iter.link->data : NULL), \

Comments