Fix spectre warning for MSVC
This commit is contained in:
parent
ed4ec54c7a
commit
fe2bb65b06
@ -29,8 +29,12 @@ u32 wapp_cpath_join_path(Str8 *dst, const Str8List *parts) {
|
||||
const Str8Node *first_node = wapp_str8_list_get(parts, 0);
|
||||
wapp_str8_copy_str8_capped(dst, first_node->string);
|
||||
|
||||
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||
// MSVC Spectre mitigation warnings
|
||||
const Str8Node *node = first_node;
|
||||
for (u64 i = 1; i < parts->node_count; ++i) {
|
||||
u64 node_index = 1;
|
||||
bool running = true;
|
||||
while (running && node->next) {
|
||||
node = node->next;
|
||||
if (node->string->size == 0) {
|
||||
continue;
|
||||
@ -47,6 +51,9 @@ u32 wapp_cpath_join_path(Str8 *dst, const Str8List *parts) {
|
||||
}
|
||||
|
||||
wapp_str8_concat_capped(dst, node->string);
|
||||
|
||||
++node_index;
|
||||
running = node_index < parts->node_count;
|
||||
}
|
||||
|
||||
return CPATH_JOIN_SUCCESS;
|
||||
|
Loading…
Reference in New Issue
Block a user