Start str8 renaming
This commit is contained in:
+11
-11
@@ -11,7 +11,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
u32 wapp_cpath_join_path(Str8 *dst, const Str8List *parts) {
|
||||
u32 wapp_cpath_join_path(WpStr8 *dst, const WpStr8List *parts) {
|
||||
if (!dst || !parts) {
|
||||
return CPATH_JOIN_INVALID_ARGS;
|
||||
}
|
||||
@@ -20,7 +20,7 @@ u32 wapp_cpath_join_path(Str8 *dst, const Str8List *parts) {
|
||||
return CPATH_JOIN_EMPTY_PARTS;
|
||||
}
|
||||
|
||||
Str8 separator = wapp_str8_buf(4);
|
||||
WpStr8 separator = wapp_str8_buf(4);
|
||||
wapp_str8_push_back(&separator, WAPP_PATH_SEP);
|
||||
|
||||
u64 required_capacity = parts->node_count * separator.size + wapp_str8_list_total_size(parts);
|
||||
@@ -29,16 +29,16 @@ u32 wapp_cpath_join_path(Str8 *dst, const Str8List *parts) {
|
||||
}
|
||||
|
||||
// Handle first node
|
||||
Str8 *first_node = wapp_dbl_list_get(Str8, parts, 0);
|
||||
WpStr8 *first_node = wapp_dbl_list_get(WpStr8, parts, 0);
|
||||
wapp_str8_copy_str8_capped(dst, first_node);
|
||||
|
||||
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||
// MSVC Spectre mitigation warnings
|
||||
Str8 *node = first_node;
|
||||
WpStr8 *node = first_node;
|
||||
u64 node_index = 1;
|
||||
b8 running = node_index < parts->node_count;
|
||||
while (running) {
|
||||
node = wapp_dbl_list_get(Str8, parts, node_index);
|
||||
node = wapp_dbl_list_get(WpStr8, parts, node_index);
|
||||
if (node->size == 0) {
|
||||
goto CPATH_JOIN_LOOP_END;
|
||||
}
|
||||
@@ -63,14 +63,14 @@ CPATH_JOIN_LOOP_END:
|
||||
return CPATH_JOIN_SUCCESS;
|
||||
}
|
||||
|
||||
Str8 *dirup(const Allocator *allocator, Str8RO *path, u64 levels) {
|
||||
Str8 *output = NULL;
|
||||
WpStr8 *dirup(const Allocator *allocator, WpStr8RO *path, u64 levels) {
|
||||
WpStr8 *output = NULL;
|
||||
if (!allocator || !path) {
|
||||
goto RETURN_DIRUP;
|
||||
}
|
||||
|
||||
b8 absolute = wapp_str8_get(path, 0) == WAPP_PATH_SEP;
|
||||
Str8 separator = wapp_str8_buf(4);
|
||||
WpStr8 separator = wapp_str8_buf(4);
|
||||
wapp_str8_push_back(&separator, WAPP_PATH_SEP);
|
||||
|
||||
if (path->size == 0) {
|
||||
@@ -93,7 +93,7 @@ Str8 *dirup(const Allocator *allocator, Str8RO *path, u64 levels) {
|
||||
goto RETURN_DIRUP;
|
||||
}
|
||||
|
||||
Str8List *parts = wapp_str8_split(&tmp_arena, path, &separator);
|
||||
WpStr8List *parts = wapp_str8_split(&tmp_arena, path, &separator);
|
||||
if (!parts) {
|
||||
goto RETURN_DIRUP;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ Str8 *dirup(const Allocator *allocator, Str8RO *path, u64 levels) {
|
||||
wapp_str8_push_back(output, absolute ? WAPP_PATH_SEP : '.');
|
||||
} else {
|
||||
for (u64 i = 0; i < levels; ++i) {
|
||||
wapp_dbl_list_pop_back(Str8, parts);
|
||||
wapp_dbl_list_pop_back(WpStr8, parts);
|
||||
}
|
||||
|
||||
u64 alignment = sizeof(void *) * 2;
|
||||
@@ -121,7 +121,7 @@ Str8 *dirup(const Allocator *allocator, Str8RO *path, u64 levels) {
|
||||
wapp_str8_push_back(output, WAPP_PATH_SEP);
|
||||
}
|
||||
|
||||
Str8 *joined = wapp_str8_join(&tmp_arena, parts, &separator);
|
||||
WpStr8 *joined = wapp_str8_join(&tmp_arena, parts, &separator);
|
||||
if (joined) {
|
||||
wapp_str8_concat_capped(output, joined);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user