[libvirt PATCH v3 1/9] internal: Add CONCAT macro

Tim Wiederhake twiederh at redhat.com
Thu Sep 30 11:24:51 UTC 2021


Using the two-step idiom to force resolution of other macros, e.g.:

  #define bar BAR
  CONCAT_(foo, bar)     // foobar
  CONCAT(foo, bar)      // fooBAR

Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/internal.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/internal.h b/src/internal.h
index e1250a59fe..48188e6fa3 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -93,6 +93,9 @@
 
 #define NUL_TERMINATE(buf) do { (buf)[sizeof(buf)-1] = '\0'; } while (0)
 
+#define CONCAT_(a, b) a ## b
+#define CONCAT(a, b) CONCAT_(a, b)
+
 #ifdef WIN32
 # ifndef O_CLOEXEC
 #  define O_CLOEXEC _O_NOINHERIT
-- 
2.31.1




More information about the libvir-list mailing list