src/cx/string.h

changeset 684
380bd45bc94a
parent 677
b09aae58bba4
child 693
494d9b20b99e
--- a/src/cx/string.h	Sun Apr 16 21:35:08 2023 +0200
+++ b/src/cx/string.h	Mon Apr 17 21:47:34 2023 +0200
@@ -129,6 +129,18 @@
  */
 typedef struct cx_strtok_ctx_s CxStrtokCtx;
 
+#ifdef __cplusplus
+extern "C" {
+
+/**
+ * A literal initializer for an UCX string structure.
+ *
+ * @param literal the string literal
+ */
+#define CX_STR(literal) cxstring{literal, sizeof(literal) - 1}
+
+#else // __cplusplus
+
 /**
  * A literal initializer for an UCX string structure.
  *
@@ -136,10 +148,8 @@
  *
  * @param literal the string literal
  */
-#define CX_STR(literal) {literal, sizeof(literal) - 1}
+#define CX_STR(literal) (cxstring){literal, sizeof(literal) - 1}
 
-#ifdef __cplusplus
-extern "C" {
 #endif
 
 

mercurial