diff --git a/src/linker/base_ext/base_core.h b/src/linker/base_ext/base_core.h index deb18e8c..e3d53292 100644 --- a/src/linker/base_ext/base_core.h +++ b/src/linker/base_ext/base_core.h @@ -110,10 +110,6 @@ //////////////////////////////// -#define MemoryIsZeroStruct(p) memory_is_zero(p, sizeof(*p)) - -//////////////////////////////// - typedef struct { U64 major; diff --git a/src/linker/lnk_config.c b/src/linker/lnk_config.c index 78799391..6bedf521 100644 --- a/src/linker/lnk_config.c +++ b/src/linker/lnk_config.c @@ -333,15 +333,20 @@ internal String8 lnk_error_check_and_strip_quotes(LNK_ErrorCode error_code, LNK_Obj *obj, LNK_CmdSwitchType cmd_switch, String8 string) { String8 result = string; - B32 starts_with_quote = str8_match_lit("\"", string, StringMatchFlag_RightSideSloppy); - if (starts_with_quote) { - if (str8_ends_with_lit(string, "\"", 0)) { - result = str8_skip(result, 1); - result = str8_chop(result, 1); - } else { - lnk_error_cmd_switch(error_code, obj, cmd_switch, "detected unmatched \" in \"%S\"", string); - } + + B32 starts_with_quote = str8_match(str8_substr(string, rng_1u64(0,1)), str8_lit("\""), 0); + B32 ends_with_quote = 0; + if (string.size > 2) { + ends_with_quote = str8_match(str8_substr(string, rng_1u64(string.size-1,string.size)), str8_lit("\""), 0); } + + if (starts_with_quote && ends_with_quote) { + result = str8_skip(result, 1); + result = str8_chop(result, 1); + } else if (starts_with_quote && !ends_with_quote) { + lnk_error_cmd_switch(error_code, obj, cmd_switch, "detected unmatched \" in \"%S\"", string); + } + return result; } diff --git a/src/linker/lnk_debug_info.c b/src/linker/lnk_debug_info.c index ff4d2d72..4905bae5 100644 --- a/src/linker/lnk_debug_info.c +++ b/src/linker/lnk_debug_info.c @@ -4201,7 +4201,7 @@ lnk_src_file_hash_table_lookup_slot(LNK_SourceFileBucket **buckets, if (buckets[bucket_idx] == 0) { break; } - if (rdib_source_file_match(buckets[bucket_idx]->src_file, &temp, operating_system_from_context())) { + if (rdib_source_file_match(buckets[bucket_idx]->src_file, &temp, OperatingSystem_CURRENT)) { return buckets[bucket_idx]; } bucket_idx = (bucket_idx + 1) % cap; @@ -4233,7 +4233,7 @@ lnk_src_file_insert_or_update(LNK_SourceFileBucket **buckets, U64 cap, U64 hash, // another thread took the bucket... goto retry; - } else if (rdib_source_file_match(curr_bucket->src_file, new_bucket->src_file, operating_system_from_context())) { + } else if (rdib_source_file_match(curr_bucket->src_file, new_bucket->src_file, OperatingSystem_CURRENT)) { // do we need to update value in the bucket? int cmp = u64_compar(&curr_bucket->obj_idx, &new_bucket->obj_idx); if (cmp <= 0) { diff --git a/src/linker/thread_pool/thread_pool.c b/src/linker/thread_pool/thread_pool.c index a99c821e..4a171756 100644 --- a/src/linker/thread_pool/thread_pool.c +++ b/src/linker/thread_pool/thread_pool.c @@ -63,9 +63,9 @@ tp_alloc(Arena *arena, U32 worker_count, U32 max_worker_count, String8 name) B32 is_shared = (name.size > 0); // alloc semaphores - OS_Handle main_semaphore = {0}; - OS_Handle task_semaphore = {0}; - OS_Handle exec_semaphore = {0}; + Semaphore main_semaphore = {0}; + Semaphore task_semaphore = {0}; + Semaphore exec_semaphore = {0}; if (worker_count > 1) { main_semaphore = os_semaphore_alloc(0, 1, str8_zero()); if (is_shared) { @@ -111,7 +111,7 @@ tp_release(TP_Context *pool) { pool->is_live = 0; - B32 is_shared = !os_handle_match(pool->exec_semaphore, os_handle_zero()); + B32 is_shared = pool->exec_semaphore.u64[0] != 0; if (is_shared) { for (U64 i = 0; i < pool->worker_count; ++i) { os_semaphore_drop(pool->exec_semaphore); @@ -209,7 +209,7 @@ tp_for_parallel(TP_Context *pool, TP_Arena *task_arena, U64 task_count, TP_TaskF U64 drop_count = Min(task_count, pool->worker_count); // if we are in shared mode ping local semaphore - if (!os_handle_match(pool->exec_semaphore, os_handle_zero())) { + if (pool->exec_semaphore.u64[0] != 0) { for (U64 worker_idx = 0; worker_idx < drop_count; worker_idx +=1) { os_semaphore_drop(pool->exec_semaphore); } diff --git a/src/linker/thread_pool/thread_pool.h b/src/linker/thread_pool/thread_pool.h index abea5cbd..e2487560 100644 --- a/src/linker/thread_pool/thread_pool.h +++ b/src/linker/thread_pool/thread_pool.h @@ -28,9 +28,9 @@ typedef struct TP_Worker typedef struct TP_Context { B32 is_live; - OS_Handle exec_semaphore; - OS_Handle task_semaphore; - OS_Handle main_semaphore; + Semaphore exec_semaphore; + Semaphore task_semaphore; + Semaphore main_semaphore; U32 worker_count; TP_Worker *worker_arr;