for (ASSIGN_CONTAINER(RULE, cls_cursor_first(CURSOR), MEMBER); \
(RULE != OBJECT_CONTAINING(NULL, RULE, MEMBER) \
? ASSIGN_CONTAINER(NEXT, cls_cursor_next(CURSOR, &(RULE)->MEMBER), \
- MEMBER) \
+ MEMBER), 1 \
: 0); \
(RULE) = (NEXT))
/*
- * Copyright (c) 2012 Nicira, Inc.
+ * Copyright (c) 2012, 2013 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#define HEAP_FOR_EACH(NODE, MEMBER, HEAP) \
for (((HEAP)->n > 0 \
? ASSIGN_CONTAINER(NODE, (HEAP)->array[1], MEMBER) \
- : ((NODE) = NULL, 1)); \
+ : ((NODE) = NULL, (void) 0)); \
(NODE) != NULL; \
((NODE)->MEMBER.idx < (HEAP)->n \
? ASSIGN_CONTAINER(NODE, \
(HEAP)->array[(NODE)->MEMBER.idx + 1], \
MEMBER) \
- : ((NODE) = NULL, 1)))
+ : ((NODE) = NULL, (void) 0)))
\f
/* Returns the index of the node that is the parent of the node with the given
* 'idx' within a heap. */
#define HINDEX_FOR_EACH_SAFE(NODE, NEXT, MEMBER, HINDEX) \
for (ASSIGN_CONTAINER(NODE, hindex_first(HINDEX), MEMBER); \
(NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER) \
- ? ASSIGN_CONTAINER(NEXT, hindex_next(HINDEX, &(NODE)->MEMBER), MEMBER) \
+ ? ASSIGN_CONTAINER(NEXT, hindex_next(HINDEX, &(NODE)->MEMBER), MEMBER), 1 \
: 0); \
(NODE) = (NEXT))
#define HMAP_FOR_EACH_SAFE(NODE, NEXT, MEMBER, HMAP) \
for (ASSIGN_CONTAINER(NODE, hmap_first(HMAP), MEMBER); \
(NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER) \
- ? ASSIGN_CONTAINER(NEXT, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER) \
+ ? ASSIGN_CONTAINER(NEXT, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER), 1 \
: 0); \
(NODE) = (NEXT))
for (ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.prev, MEMBER); \
&(ITER)->MEMBER != (LIST); \
ASSIGN_CONTAINER(ITER, (ITER)->MEMBER.prev, MEMBER))
-#define LIST_FOR_EACH_SAFE(ITER, NEXT, MEMBER, LIST) \
- for (ASSIGN_CONTAINER(ITER, (LIST)->next, MEMBER); \
- (&(ITER)->MEMBER != (LIST) \
- ? ASSIGN_CONTAINER(NEXT, (ITER)->MEMBER.next, MEMBER) \
- : 0); \
+#define LIST_FOR_EACH_SAFE(ITER, NEXT, MEMBER, LIST) \
+ for (ASSIGN_CONTAINER(ITER, (LIST)->next, MEMBER); \
+ (&(ITER)->MEMBER != (LIST) \
+ ? ASSIGN_CONTAINER(NEXT, (ITER)->MEMBER.next, MEMBER), 1 \
+ : 0); \
(ITER) = (NEXT))
#endif /* list.h */
* that that OBJECT points to, assigns the address of the outer object to
* OBJECT, which must be an lvalue.
*
- * Evaluates to 1. */
+ * Evaluates to (void) 0 as the result is not to be used. */
#define ASSIGN_CONTAINER(OBJECT, POINTER, MEMBER) \
- ((OBJECT) = OBJECT_CONTAINING(POINTER, OBJECT, MEMBER), 1)
+ ((OBJECT) = OBJECT_CONTAINING(POINTER, OBJECT, MEMBER), (void) 0)
#ifdef __cplusplus
extern "C" {