From 6119cf5c5f9940804f40be77c37bc7af0609a475 Mon Sep 17 00:00:00 2001 From: Abdelrahman Said Date: Sun, 23 Feb 2025 23:53:28 +0000 Subject: [PATCH] Improve Str8 macros ergonomics --- src/core/strings/str8/str8.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/strings/str8/str8.h b/src/core/strings/str8/str8.h index 800dafd..6e8b20d 100644 --- a/src/core/strings/str8/str8.h +++ b/src/core/strings/str8/str8.h @@ -38,7 +38,7 @@ struct str8_list { * 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_varg(STRING) (int)((STRING).size), (STRING).buf /** * Str8 stack buffers @@ -106,7 +106,7 @@ Str8 *wapp_str8_join(const Allocator *allocator, const Str8List *list, Str8R * Str8 list utilities */ #define wapp_str8_node_from_cstr(STRING) ((Str8Node){.string = &wapp_str8_lit(STRING)}) -#define wapp_str8_node_from_str8(STRING) ((Str8Node){.string = &STRING}) +#define wapp_str8_node_from_str8(STRING) ((Str8Node){.string = &(STRING)}) Str8Node *wapp_str8_list_get(const Str8List *list, u64 index); void wapp_str8_list_push_front(Str8List *list, Str8Node *node); void wapp_str8_list_push_back(Str8List *list, Str8Node *node);