2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 22:35:15 +00:00

util: Add token concatenation macro with argument expansion.

This macro is handy when it comes paste two tokens when one or both
are macros.

Rename CURSOR_JOIN() to OVS_JOIN() and move it to util.h so that it can
be reused.

Signed-off-by: Paolo Valerio <pvalerio@redhat.com>
Acked-by: Gaetan Rivet <grive@u256.net>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
This commit is contained in:
Paolo Valerio
2021-07-06 15:03:12 +02:00
committed by Ilya Maximets
parent 1e19f9aa26
commit fa0e2d26df
2 changed files with 8 additions and 4 deletions

View File

@@ -245,9 +245,6 @@ void cmap_cursor_advance(struct cmap_cursor *);
/* Generate a unique name for the cursor with the __COUNTER__ macro to
* allow nesting of CMAP_FOR_EACH loops. */
#define CURSOR_JOIN2(x,y) x##y
#define CURSOR_JOIN(x, y) CURSOR_JOIN2(x,y)
#define CMAP_FOR_EACH__(NODE, MEMBER, CMAP, CURSOR_NAME) \
for (struct cmap_cursor CURSOR_NAME = cmap_cursor_start(CMAP); \
CMAP_CURSOR_FOR_EACH__(NODE, &CURSOR_NAME, MEMBER); \
@@ -255,7 +252,7 @@ void cmap_cursor_advance(struct cmap_cursor *);
#define CMAP_FOR_EACH(NODE, MEMBER, CMAP) \
CMAP_FOR_EACH__(NODE, MEMBER, CMAP, \
CURSOR_JOIN(cursor_, __COUNTER__))
OVS_JOIN(cursor_, __COUNTER__))
static inline struct cmap_node *cmap_first(const struct cmap *);