1.1 --- a/src/ucx/string.h Tue May 29 10:02:55 2018 +0200 1.2 +++ b/src/ucx/string.h Tue May 29 11:05:12 2018 +0200 1.3 @@ -52,17 +52,33 @@ 1.4 #include "allocator.h" 1.5 #include <stddef.h> 1.6 1.7 -/** Shortcut for a <code>sstr_t struct</code> literal. */ 1.8 -#define ST(s) { (char*)s, sizeof(s)-1 } 1.9 +/* 1.10 + * Use this macro to disable the shortcuts if you experience macro collision. 1.11 + */ 1.12 +#ifndef UCX_NO_SSTR_SHORTCUTS 1.13 +/** 1.14 + * Shortcut for a <code>sstr_t struct</code> 1.15 + * or <code>scstr_t struct</code> literal. 1.16 + */ 1.17 +#define ST(s) { s, sizeof(s)-1 } 1.18 1.19 /** Shortcut for the conversion of a C string to a <code>sstr_t</code>. */ 1.20 -#define S(s) sstrn((char*)s, sizeof(s)-1) 1.21 +#define S(s) sstrn(s, sizeof(s)-1) 1.22 1.23 +/** Shortcut for the conversion of a C string to a <code>scstr_t</code>. */ 1.24 +#define SC(s) scstrn(s, sizeof(s)-1) 1.25 +#endif /* UCX_NO_SSTR_SHORTCUTS */ 1.26 + 1.27 +/* 1.28 + * Use this macro to disable the format macros. 1.29 + */ 1.30 +#ifndef UCX_NO_SSTR_FORMAT_MACROS 1.31 /** Expands a sstr_t or scstr_t to printf arguments. */ 1.32 #define SFMT(s) (int) (s).length, (s).ptr 1.33 1.34 /** Format specifier for a sstr_t or scstr_t. */ 1.35 #define PRIsstr ".*s" 1.36 +#endif /* UCX_NO_SSTR_FORMAT_MACROS */ 1.37 1.38 #ifdef __cplusplus 1.39 extern "C" {