Add utils for str8 printing

This commit is contained in:
Abdelrahman Said 2025-02-09 15:13:50 +00:00
parent bbf38499ca
commit d1d6a8e64b

View File

@ -17,6 +17,10 @@ struct str8 {
typedef const Str8 Str8RO; typedef const Str8 Str8RO;
// Utilities to be used with printf functions
#define WAPP_STR8_SPEC "%.*s"
#define wapp_str8_varg(STRING) (int)STRING.size, STRING.buf
#define wapp_str8_buf(CAPACITY) ((Str8){.capacity = CAPACITY, .size = 0, .buf = (c8[CAPACITY]){0}}) #define wapp_str8_buf(CAPACITY) ((Str8){.capacity = CAPACITY, .size = 0, .buf = (c8[CAPACITY]){0}})
// Utilises the fact that memcpy returns pointer to dest buffer and that getting // Utilises the fact that memcpy returns pointer to dest buffer and that getting