@@ -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 *);
@@ -105,6 +105,13 @@ ovs_prefetch_range(const void *start, size_t size)
#define OVS_NOT_REACHED() abort()
+/* Joins two token expanding the arguments if they are macros.
+ *
+ * For token concatenation the circumlocution is needed for the
+ * expansion. */
+#define OVS_JOIN2(X, Y) X##Y
+#define OVS_JOIN(X, Y) OVS_JOIN2(X, Y)
+
/* Use "%"PRIuSIZE to format size_t with printf(). */
#ifdef _WIN32
#define PRIdSIZE "Id"