mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 12:48:14 +00:00
Add gb_internal to procedures
This commit is contained in:
+11
-12
@@ -4,7 +4,7 @@ gb_internal GB_COMPARE_PROC(string_cmp) {
|
|||||||
return string_compare(x, y);
|
return string_compare(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool recursively_delete_directory(wchar_t *wpath_c) {
|
gb_internal bool recursively_delete_directory(wchar_t *wpath_c) {
|
||||||
#if defined(GB_SYSTEM_WINDOWS)
|
#if defined(GB_SYSTEM_WINDOWS)
|
||||||
auto const is_dots_w = [](wchar_t const *str) -> bool {
|
auto const is_dots_w = [](wchar_t const *str) -> bool {
|
||||||
if (!str) {
|
if (!str) {
|
||||||
@@ -70,7 +70,7 @@ bool recursively_delete_directory(wchar_t *wpath_c) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool recursively_delete_directory(String const &path) {
|
gb_internal bool recursively_delete_directory(String const &path) {
|
||||||
#if defined(GB_SYSTEM_WINDOWS)
|
#if defined(GB_SYSTEM_WINDOWS)
|
||||||
String16 wpath = string_to_string16(permanent_allocator(), path);
|
String16 wpath = string_to_string16(permanent_allocator(), path);
|
||||||
wchar_t *wpath_c = alloc_wstring(permanent_allocator(), wpath);
|
wchar_t *wpath_c = alloc_wstring(permanent_allocator(), wpath);
|
||||||
@@ -80,13 +80,12 @@ bool recursively_delete_directory(String const &path) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int try_clear_cache(void) {
|
gb_internal bool try_clear_cache(void) {
|
||||||
bool ok = recursively_delete_directory(str_lit(".odin-cache"));
|
return recursively_delete_directory(str_lit(".odin-cache"));
|
||||||
return ok ? 0 : 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
u64 crc64_with_seed(void const *data, isize len, u64 seed) {
|
gb_internal u64 crc64_with_seed(void const *data, isize len, u64 seed) {
|
||||||
isize remaining;
|
isize remaining;
|
||||||
u64 result = ~seed;
|
u64 result = ~seed;
|
||||||
u8 const *c = cast(u8 const *)data;
|
u8 const *c = cast(u8 const *)data;
|
||||||
@@ -96,7 +95,7 @@ u64 crc64_with_seed(void const *data, isize len, u64 seed) {
|
|||||||
return ~result;
|
return ~result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool check_if_exists_file_otherwise_create(String const &str) {
|
gb_internal bool check_if_exists_file_otherwise_create(String const &str) {
|
||||||
char const *str_c = alloc_cstring(permanent_allocator(), str);
|
char const *str_c = alloc_cstring(permanent_allocator(), str);
|
||||||
if (!gb_file_exists(str_c)) {
|
if (!gb_file_exists(str_c)) {
|
||||||
gbFile f = {};
|
gbFile f = {};
|
||||||
@@ -108,7 +107,7 @@ bool check_if_exists_file_otherwise_create(String const &str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool check_if_exists_directory_otherwise_create(String const &str) {
|
gb_internal bool check_if_exists_directory_otherwise_create(String const &str) {
|
||||||
#if defined(GB_SYSTEM_WINDOWS)
|
#if defined(GB_SYSTEM_WINDOWS)
|
||||||
String16 wstr = string_to_string16(permanent_allocator(), str);
|
String16 wstr = string_to_string16(permanent_allocator(), str);
|
||||||
wchar_t *wstr_c = alloc_wstring(permanent_allocator(), wstr);
|
wchar_t *wstr_c = alloc_wstring(permanent_allocator(), wstr);
|
||||||
@@ -121,7 +120,7 @@ bool check_if_exists_directory_otherwise_create(String const &str) {
|
|||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
bool try_copy_executable_cache_internal(bool to_cache) {
|
gb_internal bool try_copy_executable_cache_internal(bool to_cache) {
|
||||||
String exe_name = path_to_string(heap_allocator(), build_context.build_paths[BuildPath_Output]);
|
String exe_name = path_to_string(heap_allocator(), build_context.build_paths[BuildPath_Output]);
|
||||||
defer (gb_free(heap_allocator(), exe_name.text));
|
defer (gb_free(heap_allocator(), exe_name.text));
|
||||||
|
|
||||||
@@ -162,7 +161,7 @@ bool try_copy_executable_cache_internal(bool to_cache) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool try_copy_executable_to_cache(void) {
|
gb_internal bool try_copy_executable_to_cache(void) {
|
||||||
debugf("Cache: try_copy_executable_to_cache\n");
|
debugf("Cache: try_copy_executable_to_cache\n");
|
||||||
|
|
||||||
if (try_copy_executable_cache_internal(true)) {
|
if (try_copy_executable_cache_internal(true)) {
|
||||||
@@ -172,7 +171,7 @@ bool try_copy_executable_to_cache(void) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool try_copy_executable_from_cache(void) {
|
gb_internal bool try_copy_executable_from_cache(void) {
|
||||||
debugf("Cache: try_copy_executable_from_cache\n");
|
debugf("Cache: try_copy_executable_from_cache\n");
|
||||||
|
|
||||||
if (try_copy_executable_cache_internal(false)) {
|
if (try_copy_executable_cache_internal(false)) {
|
||||||
@@ -186,7 +185,7 @@ bool try_copy_executable_from_cache(void) {
|
|||||||
|
|
||||||
|
|
||||||
// returns false if different, true if it is the same
|
// returns false if different, true if it is the same
|
||||||
bool try_cached_build(Checker *c, Array<String> const &args) {
|
gb_internal bool try_cached_build(Checker *c, Array<String> const &args) {
|
||||||
TEMPORARY_ALLOCATOR_GUARD();
|
TEMPORARY_ALLOCATOR_GUARD();
|
||||||
|
|
||||||
Parser *p = c->parser;
|
Parser *p = c->parser;
|
||||||
|
|||||||
+1
-1
@@ -3058,7 +3058,7 @@ int main(int arg_count, char const **arg_ptr) {
|
|||||||
gb_printf("%.*s", LIT(odin_root_dir()));
|
gb_printf("%.*s", LIT(odin_root_dir()));
|
||||||
return 0;
|
return 0;
|
||||||
} else if (command == "clear-cache") {
|
} else if (command == "clear-cache") {
|
||||||
return try_clear_cache();
|
return try_clear_cache() ? 0 : 1;
|
||||||
} else {
|
} else {
|
||||||
String argv1 = {};
|
String argv1 = {};
|
||||||
if (args.count > 1) {
|
if (args.count > 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user