sv: SV_AUTO macro (for literal strings/literal byte arrays really).
This commit is contained in:
@@ -19,6 +19,7 @@ typedef struct
|
||||
|
||||
// String view macro constructor
|
||||
#define SV(DATA, SIZE) ((sv_t){.data = (DATA), .size = (SIZE)})
|
||||
#define SV_AUTO(DATA) ((sv_t){.data = (void *)(DATA), .size = sizeof(DATA) - 1})
|
||||
// Pretty printers
|
||||
#define SV_FMT(SV) (int)(SV).size, (SV).data
|
||||
#define PR_SV "%.*s"
|
||||
|
||||
Reference in New Issue
Block a user