summaryrefslogtreecommitdiffstats
path: root/common/ring.h
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2011-08-22 16:17:28 +0100
committerAlon Levy <alevy@redhat.com>2011-08-23 17:01:14 +0300
commit9a444f66c22023e3e048d993ca735ffeff9057a5 (patch)
tree2f36f8648b2a3628e5e94e3b8f1c85bbdacae996 /common/ring.h
parent70a5360e1cdcb4d3db2e4187e4b5db96c3955ca5 (diff)
downloadspice-9a444f66c22023e3e048d993ca735ffeff9057a5.tar.gz
spice-9a444f66c22023e3e048d993ca735ffeff9057a5.tar.xz
spice-9a444f66c22023e3e048d993ca735ffeff9057a5.zip
common/ring: RING_FOREACH_SAFE: use shorter version from qemu
Diffstat (limited to 'common/ring.h')
-rw-r--r--common/ring.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/common/ring.h b/common/ring.h
index bd030d25..304bc9a5 100644
--- a/common/ring.h
+++ b/common/ring.h
@@ -136,11 +136,9 @@ static inline RingItem *ring_prev(Ring *ring, RingItem *pos)
}
#define RING_FOREACH_SAFE(var, next, ring) \
- for ((var) = ring_get_head(ring), \
- (next) = (var) ? ring_next(ring, (var)) : NULL; \
- (var); \
- (var) = (next), \
- (next) = (var) ? ring_next(ring, (var)) : NULL)
+ for ((var) = ring_get_head(ring); \
+ (var) && ((next) = ring_next(ring, (var)), 1); \
+ (var) = (next))
#define RING_FOREACH(var, ring) \