summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2017-12-08 19:18:04 +0000
committerFrediano Ziglio <freddy77@gmail.com>2024-05-28 22:20:11 +0100
commit955055d97a4abd78efcf14d15b52c5afdbe38acb (patch)
tree6faad09d6fe5be49815a10ca4e8899163625b0a9
parent6ac7b4bae556cf09712eab635854196ad364d004 (diff)
WIP use only a pointer to scan the ring
-rw-r--r--server/video-stream.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/server/video-stream.cpp b/server/video-stream.cpp
index f1aa3af3..d541cd39 100644
--- a/server/video-stream.cpp
+++ b/server/video-stream.cpp
@@ -26,16 +26,10 @@
#define FOREACH_STREAMS(streams, item) \
RING_FOREACH(item, &(streams)->streams)
-typedef struct RingIter {
- RingItem *link;
- RingItem *next;
-} RingIter;
-
#define FOREACH_AGENTS_HELPER(_ring, _iter, _data) \
- for (RingIter _iter = { .link = ring_get_head(_ring) }; \
- _iter.link && ((_data) = SPICE_CONTAINEROF(_iter.link, VideoStreamAgents, agents_in_streams), 1) && \
- (_iter.next = ring_next(_ring, _iter.link), 1); \
- _iter.link = _iter.next)
+ for (RingItem *_iter = ring_get_head(_ring); \
+ _iter && ((_data) = SPICE_CONTAINEROF(_iter, VideoStreamAgents, agents_in_streams), 1) && \
+ (_iter = ring_next(_ring, _iter), 1); )
#define FOREACH_AGENTS(_streams, _data) \
FOREACH_AGENTS_HELPER(&(_streams)->agents, G_PASTE(_iter_, __LINE__), _data)