diff -r 343bff4cc0b5 -r a3e63cb21e20 src/ucx/string.h --- a/src/ucx/string.h Tue May 29 10:02:55 2018 +0200 +++ b/src/ucx/string.h Tue May 29 11:05:12 2018 +0200 @@ -52,17 +52,33 @@ #include "allocator.h" #include -/** Shortcut for a sstr_t struct literal. */ -#define ST(s) { (char*)s, sizeof(s)-1 } +/* + * Use this macro to disable the shortcuts if you experience macro collision. + */ +#ifndef UCX_NO_SSTR_SHORTCUTS +/** + * Shortcut for a sstr_t struct + * or scstr_t struct literal. + */ +#define ST(s) { s, sizeof(s)-1 } /** Shortcut for the conversion of a C string to a sstr_t. */ -#define S(s) sstrn((char*)s, sizeof(s)-1) +#define S(s) sstrn(s, sizeof(s)-1) +/** Shortcut for the conversion of a C string to a scstr_t. */ +#define SC(s) scstrn(s, sizeof(s)-1) +#endif /* UCX_NO_SSTR_SHORTCUTS */ + +/* + * Use this macro to disable the format macros. + */ +#ifndef UCX_NO_SSTR_FORMAT_MACROS /** Expands a sstr_t or scstr_t to printf arguments. */ #define SFMT(s) (int) (s).length, (s).ptr /** Format specifier for a sstr_t or scstr_t. */ #define PRIsstr ".*s" +#endif /* UCX_NO_SSTR_FORMAT_MACROS */ #ifdef __cplusplus extern "C" {