Prefix static macros

This commit is contained in:
2025-10-18 16:17:13 +01:00
parent 9f32891bbc
commit 0354c7b485
26 changed files with 169 additions and 169 deletions

View File

@@ -37,14 +37,14 @@ typedef const Str8 Str8RO;
#ifdef WAPP_PLATFORM_CPP
// Uses a lambda to achieve the same behaviour achieved by the C macro
#define wapp_str8_buf(CAPACITY) ([&](){ \
persistent c8 buf[CAPACITY] = {}; \
wapp_persist c8 buf[CAPACITY] = {}; \
memset(buf, 0, CAPACITY); \
return Str8{CAPACITY, 0, buf}; \
}())
// Uses a lambda to achieve the same behaviour achieved by the C macro
#define wapp_str8_lit(STRING) ([&]() { \
persistent c8 buf[sizeof(STRING) * 2] = {}; \
wapp_persist c8 buf[sizeof(STRING) * 2] = {}; \
memcpy(buf, STRING, sizeof(STRING)); \
return Str8{(sizeof(STRING) - 1) * 2, sizeof(STRING) - 1, buf}; \
}())
@@ -121,11 +121,11 @@ Str8 *wapp_str8_join(const Allocator *allocator, const Str8List *list, Str8R
*/
#ifdef WAPP_PLATFORM_CPP
#define wapp_str8_node_from_cstr(STRING) wapp_str8_list_node([&]() { \
persistent Str8 str = wapp_str8_lit(STRING); \
wapp_persist Str8 str = wapp_str8_lit(STRING); \
return &str; \
}())
#define wapp_str8_node_from_str8(STRING) wapp_str8_list_node([&]() { \
persistent Str8 str = STRING; \
wapp_persist Str8 str = STRING; \
return &str; \
}())
#else