2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-04 00:05:15 +00:00

smap: New macro SMAP_CONST2 for an immutable map of 2 key-value pairs.

Future commits will add a user.

Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
This commit is contained in:
Ben Pfaff
2016-03-29 15:04:04 -07:00
parent 9784ffaf35
commit 64982ba24c
2 changed files with 22 additions and 14 deletions

View File

@@ -68,11 +68,11 @@ struct hmap {
#define HMAP_INITIALIZER(HMAP) \
{ (struct hmap_node **const) &(HMAP)->one, NULL, 0, 0 }
/* Initializer for an immutable struct hmap 'HMAP' that contains a single
* 'NODE'. */
#define HMAP_CONST1(HMAP, NODE) { \
CONST_CAST(struct hmap_node **, &(HMAP)->one), NODE, 0, 1 }
#define HMAP_NODE_INIT(HASH) { HASH, NULL }
/* Initializer for an immutable struct hmap 'HMAP' that contains 'N' nodes
* linked together starting at 'NODE'. The hmap only has a single chain of
* hmap_nodes, so 'N' should be small. */
#define HMAP_CONST(HMAP, N, NODE) { \
CONST_CAST(struct hmap_node **, &(HMAP)->one), NODE, 0, N }
/* Initialization. */
void hmap_init(struct hmap *);