This commit is contained in:
2025-12-07 22:00:27 +00:00
committed by Abdelrahman Said
parent 2b49bfcdbf
commit 2ccdb4ca74
3 changed files with 6 additions and 2 deletions

View File

@@ -1,3 +1,5 @@
// vim:fileencoding=utf-8:foldmethod=marker
#include "./array.h" #include "./array.h"
#include "../../common/assert/assert.h" #include "../../common/assert/assert.h"
#include "../mem_allocator/mem_allocator.h" #include "../mem_allocator/mem_allocator.h"

View File

@@ -1,3 +1,5 @@
// vim:fileencoding=utf-8:foldmethod=marker
#ifndef ARRAY_H #ifndef ARRAY_H
#define ARRAY_H #define ARRAY_H

View File

@@ -37,14 +37,14 @@ typedef const Str8 Str8RO;
#ifdef WAPP_PLATFORM_CPP #ifdef WAPP_PLATFORM_CPP
// Uses a lambda to achieve the same behaviour achieved by the C macro // Uses a lambda to achieve the same behaviour achieved by the C macro
#define wapp_str8_buf(CAPACITY) ([&](){ \ #define wapp_str8_buf(CAPACITY) ([&](){ \
wapp_persist c8 buf[CAPACITY] = {}; \ wapp_persist c8 buf[CAPACITY] = {}; \
memset(buf, 0, CAPACITY); \ memset(buf, 0, CAPACITY); \
return Str8{CAPACITY, 0, buf}; \ return Str8{CAPACITY, 0, buf}; \
}()) }())
// Uses a lambda to achieve the same behaviour achieved by the C macro // Uses a lambda to achieve the same behaviour achieved by the C macro
#define wapp_str8_lit(STRING) ([&]() { \ #define wapp_str8_lit(STRING) ([&]() { \
wapp_persist c8 buf[sizeof(STRING) * 2] = {}; \ wapp_persist c8 buf[sizeof(STRING) * 2] = {}; \
memcpy(buf, STRING, sizeof(STRING)); \ memcpy(buf, STRING, sizeof(STRING)); \
return Str8{(sizeof(STRING) - 1) * 2, sizeof(STRING) - 1, buf}; \ return Str8{(sizeof(STRING) - 1) * 2, sizeof(STRING) - 1, buf}; \
}()) }())