summaryrefslogtreecommitdiff
path: root/lib/hmap.h
diff options
context:
space:
mode:
authorGurucharan Shetty <gshetty@nicira.com>2014-09-09 14:23:07 -0700
committerGurucharan Shetty <gshetty@nicira.com>2014-09-12 09:03:10 -0700
commitf17e8ad6c6d61db95622872146a4f3706ae47166 (patch)
treea35789c2f4750d00239f6468ff1ef4c93adc4ea5 /lib/hmap.h
parent74467d5c885b8a500e0a04c455d6ee405d27bd54 (diff)
downloadopenvswitch-f17e8ad6c6d61db95622872146a4f3706ae47166.tar.gz
Avoid uninitialized variable warnings with OBJECT_OFFSETOF() in MSVC.
Implementation of OBJECT_OFFSETOF() for non-GNUC compilers like MSVC causes "uninitialized variable" warnings. Since OBJECT_OFFSETOF() is indirectly used through all the *_FOR_EACH() (through ASSIGN_CONTAINER() and OBJECT_CONTAINING()) macros, the OVS build on Windows gets littered with "uninitialized variable" warnings. This patch attempts to workaround the problem. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com> Acked-by: Saurabh Shah <ssaurabh@vmware.com> Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/hmap.h')
-rw-r--r--lib/hmap.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/hmap.h b/lib/hmap.h
index 9fb83d5ab..5fcb7a2c4 100644
--- a/lib/hmap.h
+++ b/lib/hmap.h
@@ -126,12 +126,12 @@ struct hmap_node *hmap_random_node(const struct hmap *);
* HASH is only evaluated once.
*/
#define HMAP_FOR_EACH_WITH_HASH(NODE, MEMBER, HASH, HMAP) \
- for (ASSIGN_CONTAINER(NODE, hmap_first_with_hash(HMAP, HASH), MEMBER); \
+ for (INIT_CONTAINER(NODE, hmap_first_with_hash(HMAP, HASH), MEMBER); \
NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER); \
ASSIGN_CONTAINER(NODE, hmap_next_with_hash(&(NODE)->MEMBER), \
MEMBER))
#define HMAP_FOR_EACH_IN_BUCKET(NODE, MEMBER, HASH, HMAP) \
- for (ASSIGN_CONTAINER(NODE, hmap_first_in_bucket(HMAP, HASH), MEMBER); \
+ for (INIT_CONTAINER(NODE, hmap_first_in_bucket(HMAP, HASH), MEMBER); \
NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER); \
ASSIGN_CONTAINER(NODE, hmap_next_in_bucket(&(NODE)->MEMBER), MEMBER))
@@ -148,16 +148,16 @@ bool hmap_contains(const struct hmap *, const struct hmap_node *);
/* Iterates through every node in HMAP. */
#define HMAP_FOR_EACH(NODE, MEMBER, HMAP) \
- for (ASSIGN_CONTAINER(NODE, hmap_first(HMAP), MEMBER); \
+ for (INIT_CONTAINER(NODE, hmap_first(HMAP), MEMBER); \
NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER); \
ASSIGN_CONTAINER(NODE, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER))
/* Safe when NODE may be freed (not needed when NODE may be removed from the
* hash map but its members remain accessible and intact). */
#define HMAP_FOR_EACH_SAFE(NODE, NEXT, MEMBER, HMAP) \
- for (ASSIGN_CONTAINER(NODE, hmap_first(HMAP), MEMBER); \
+ for (INIT_CONTAINER(NODE, hmap_first(HMAP), MEMBER); \
(NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER) \
- ? ASSIGN_CONTAINER(NEXT, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER), 1 \
+ ? INIT_CONTAINER(NEXT, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER), 1 \
: 0); \
(NODE) = (NEXT))