2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-05 08:45:23 +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

@@ -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"