Reformat os

This commit is contained in:
2026-01-02 00:49:21 +00:00
parent 24716505be
commit 41cac2ef7f
16 changed files with 158 additions and 158 deletions

View File

@@ -34,9 +34,9 @@ u32 wapp_cpath_join_path(Str8 *dst, const Str8List *parts) {
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
// MSVC Spectre mitigation warnings
const Str8Node *node = first_node;
u64 node_index = 1;
b8 running = node_index < parts->node_count;
const Str8Node *node = first_node;
u64 node_index = 1;
b8 running = node_index < parts->node_count;
while (running && node->next) {
node = node->next;
if (node->item->size == 0) {
@@ -44,9 +44,9 @@ u32 wapp_cpath_join_path(Str8 *dst, const Str8List *parts) {
}
if (dst->size > 0) {
char dst_last = wapp_str8_get(dst, dst->size - 1);
char node_start = wapp_str8_get(node->item, 0);
b8 add_path_sep = dst_last != WAPP_PATH_SEP && node_start != WAPP_PATH_SEP;
char dst_last = wapp_str8_get(dst, dst->size - 1);
char node_start = wapp_str8_get(node->item, 0);
b8 add_path_sep = dst_last != WAPP_PATH_SEP && node_start != WAPP_PATH_SEP;
if (add_path_sep) {
wapp_str8_concat_capped(dst, &separator);
@@ -68,8 +68,8 @@ Str8 *dirup(const Allocator *allocator, Str8RO *path, u64 levels) {
goto RETURN_DIRUP;
}
b8 absolute = wapp_str8_get(path, 0) == WAPP_PATH_SEP;
Str8 separator = wapp_str8_buf(4);
b8 absolute = wapp_str8_get(path, 0) == WAPP_PATH_SEP;
Str8 separator = wapp_str8_buf(4);
wapp_str8_push_back(&separator, WAPP_PATH_SEP);
if (path->size == 0) {
@@ -109,10 +109,10 @@ Str8 *dirup(const Allocator *allocator, Str8RO *path, u64 levels) {
wapp_dbl_list_pop_back(Str8, Str8Node, parts);
}
u64 alignment = sizeof(void *) * 2;
u64 alloc_size = wapp_str8_list_total_size(parts) + parts->node_count * separator.size;
u64 modulo = alloc_size & (alignment - 1);
alloc_size += alignment - modulo;
u64 alignment = sizeof(void *) * 2;
u64 alloc_size = wapp_str8_list_total_size(parts) + parts->node_count * separator.size;
u64 modulo = alloc_size & (alignment - 1);
alloc_size += alignment - modulo;
output = wapp_str8_alloc_buf(allocator, alloc_size);
if (output) {

View File

@@ -35,8 +35,8 @@ enum {
CPATH_JOIN_INSUFFICIENT_DST_CAPACITY,
};
u32 wapp_cpath_join_path(Str8 *dst, const Str8List *parts);
Str8 *dirup(const Allocator *allocator, Str8RO *path, u64 levels);
u32 wapp_cpath_join_path(Str8 *dst, const Str8List *parts);
Str8 *dirup(const Allocator *allocator, Str8RO *path, u64 levels);
#ifdef WAPP_PLATFORM_CPP
END_C_LINKAGE