Update microsoft_craziness.h to work correctly with the rest of the codebase (and not use WIN32_LEAN_AND_MEAN)

This commit is contained in:
gingerBill
2019-11-27 15:18:32 +00:00
parent 5ea9fc3fb0
commit 37e3e081c6
5 changed files with 158 additions and 130 deletions
+7
View File
@@ -7,6 +7,13 @@
#include <intrin.h> #include <intrin.h>
#endif #endif
#if defined(GB_SYSTEM_WINDOWS)
#define NOMINMAX 1
#include <windows.h>
#undef NOMINMAX
#endif
#define GB_WINDOWS_H_INCLUDED
#define GB_IMPLEMENTATION #define GB_IMPLEMENTATION
#include "gb/gb.h" #include "gb/gb.h"
+4
View File
@@ -291,14 +291,18 @@ extern "C" {
#if defined(GB_SYSTEM_WINDOWS) #if defined(GB_SYSTEM_WINDOWS)
#if !defined(GB_NO_WINDOWS_H) #if !defined(GB_NO_WINDOWS_H)
#define NOMINMAX 1 #define NOMINMAX 1
#if !defined(GB_WINDOWS_H_INCLUDED)
#define WIN32_LEAN_AND_MEAN 1 #define WIN32_LEAN_AND_MEAN 1
#define WIN32_MEAN_AND_LEAN 1 #define WIN32_MEAN_AND_LEAN 1
#define VC_EXTRALEAN 1 #define VC_EXTRALEAN 1
#endif
#include <windows.h> #include <windows.h>
#undef NOMINMAX #undef NOMINMAX
#if !defined(GB_WINDOWS_H_INCLUDED)
#undef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN
#undef WIN32_MEAN_AND_LEAN #undef WIN32_MEAN_AND_LEAN
#undef VC_EXTRALEAN #undef VC_EXTRALEAN
#endif
#endif #endif
#include <malloc.h> // NOTE(bill): _aligned_*() #include <malloc.h> // NOTE(bill): _aligned_*()
+17 -12
View File
@@ -1179,25 +1179,30 @@ int main(int arg_count, char **arg_ptr) {
} }
// NOTE(ic): It would be nice to extend this so that we could specify the Visual Studio version that we want instead of defaulting to the latest. // NOTE(ic): It would be nice to extend this so that we could specify the Visual Studio version that we want instead of defaulting to the latest.
Find_Result_Utf8 result = find_visual_studio_and_windows_sdk_utf8(); Find_Result_Utf8 find_result = find_visual_studio_and_windows_sdk_utf8();
defer(free_resources(&result)); // defer(free_resources(&find_result));
if (result.windows_sdk_version == 0) { if (find_result.windows_sdk_version == 0) {
gb_printf_err("Windows SDK not found.\n"); gb_printf_err("Windows SDK not found.\n");
return 1; return 1;
} }
// Add library search paths. // Add library search paths.
link_settings = gb_string_append_fmt(link_settings, " /LIBPATH:\"%s\"", result.windows_sdk_um_library_path); if (find_result.vs_library_path.len > 0) {
link_settings = gb_string_append_fmt(link_settings, " /LIBPATH:\"%s\"", result.windows_sdk_ucrt_library_path); GB_ASSERT(find_result.windows_sdk_um_library_path.len > 0);
link_settings = gb_string_append_fmt(link_settings, " /LIBPATH:\"%s\"", result.vs_library_path); GB_ASSERT(find_result.windows_sdk_ucrt_library_path.len > 0);
link_settings = gb_string_append_fmt(link_settings, " /LIBPATH:\"%.*s\"", LIT(find_result.vs_library_path));
link_settings = gb_string_append_fmt(link_settings, " /LIBPATH:\"%.*s\"", LIT(find_result.windows_sdk_um_library_path));
link_settings = gb_string_append_fmt(link_settings, " /LIBPATH:\"%.*s\"", LIT(find_result.windows_sdk_ucrt_library_path));
}
if (!build_context.use_lld) { // msvc if (!build_context.use_lld) { // msvc
if (build_context.has_resource) { if (build_context.has_resource) {
exit_code = system_exec_command_line_app("msvc-link", exit_code = system_exec_command_line_app("msvc-link",
"\"%s\\rc.exe\" /nologo /fo \"%.*s.res\" \"%.*s.rc\"", "\"%.*src.exe\" /nologo /fo \"%.*s.res\" \"%.*s.rc\"",
result.vs_exe_path, LIT(find_result.vs_exe_path),
LIT(output_base), LIT(output_base),
LIT(build_context.resource_filepath) LIT(build_context.resource_filepath)
); );
@@ -1207,23 +1212,23 @@ int main(int arg_count, char **arg_ptr) {
} }
exit_code = system_exec_command_line_app("msvc-link", exit_code = system_exec_command_line_app("msvc-link",
"\"%s\\link.exe\" \"%.*s.obj\" \"%.*s.res\" -OUT:\"%.*s.%s\" %s " "\"%.*slink.exe\" \"%.*s.obj\" \"%.*s.res\" -OUT:\"%.*s.%s\" %s "
"/nologo /incremental:no /opt:ref /subsystem:CONSOLE " "/nologo /incremental:no /opt:ref /subsystem:CONSOLE "
" %.*s " " %.*s "
" %s " " %s "
"", "",
result.vs_exe_path, LIT(output_base), LIT(output_base), LIT(output_base), output_ext, LIT(find_result.vs_exe_path), LIT(output_base), LIT(output_base), LIT(output_base), output_ext,
lib_str, LIT(build_context.link_flags), lib_str, LIT(build_context.link_flags),
link_settings link_settings
); );
} else { } else {
exit_code = system_exec_command_line_app("msvc-link", exit_code = system_exec_command_line_app("msvc-link",
"\"%s\\link.exe\" \"%.*s.obj\" -OUT:\"%.*s.%s\" %s " "\"%.*slink.exe\" \"%.*s.obj\" -OUT:\"%.*s.%s\" %s "
"/nologo /incremental:no /opt:ref /subsystem:CONSOLE " "/nologo /incremental:no /opt:ref /subsystem:CONSOLE "
" %.*s " " %.*s "
" %s " " %s "
"", "",
result.vs_exe_path, LIT(output_base), LIT(output_base), output_ext, LIT(find_result.vs_exe_path), LIT(output_base), LIT(output_base), output_ext,
lib_str, LIT(build_context.link_flags), lib_str, LIT(build_context.link_flags),
link_settings link_settings
); );
+85 -90
View File
@@ -13,14 +13,7 @@
// //
//#include <windows.h> #include <wtypesbase.h>
//#include <stdlib.h>
//#include <string.h>
//#include <assert.h>
//#include <stdio.h>
//#include <sys/stat.h>
//#include <stdint.h>
#include <io.h> // For _get_osfhandle #include <io.h> // For _get_osfhandle
#pragma comment(lib, "Advapi32.lib") #pragma comment(lib, "Advapi32.lib")
@@ -53,26 +46,29 @@
// Here is the API you need to know about: // Here is the API you need to know about:
// //
gb_global gbAllocator mc_allocator = heap_allocator();
struct Find_Result { struct Find_Result {
int windows_sdk_version; // Zero if no Windows SDK found. int windows_sdk_version; // Zero if no Windows SDK found.
wchar_t *windows_sdk_root = NULL; wchar_t *windows_sdk_root;
wchar_t *windows_sdk_um_library_path = NULL; wchar_t *windows_sdk_um_library_path;
wchar_t *windows_sdk_ucrt_library_path = NULL; wchar_t *windows_sdk_ucrt_library_path;
wchar_t *vs_exe_path = NULL; wchar_t *vs_exe_path;
wchar_t *vs_library_path = NULL; wchar_t *vs_library_path;
}; };
struct Find_Result_Utf8 { struct Find_Result_Utf8 {
int windows_sdk_version; // Zero if no Windows SDK found. int windows_sdk_version; // Zero if no Windows SDK found.
char *windows_sdk_root = NULL; String windows_sdk_root;
char *windows_sdk_um_library_path = NULL; String windows_sdk_um_library_path;
char *windows_sdk_ucrt_library_path = NULL; String windows_sdk_ucrt_library_path;
char *vs_exe_path = NULL; String vs_exe_path;
char *vs_library_path = NULL; String vs_library_path;
}; };
@@ -80,19 +76,20 @@ Find_Result find_visual_studio_and_windows_sdk();
Find_Result_Utf8 find_visual_studio_and_windows_sdk_utf8(); Find_Result_Utf8 find_visual_studio_and_windows_sdk_utf8();
void free_resources(Find_Result *result) { void free_resources(Find_Result *result) {
free(result->windows_sdk_root); // free(result->windows_sdk_root);
free(result->windows_sdk_um_library_path); // free(result->windows_sdk_um_library_path);
free(result->windows_sdk_ucrt_library_path); // free(result->windows_sdk_ucrt_library_path);
free(result->vs_exe_path); // free(result->vs_exe_path);
free(result->vs_library_path); // free(result->vs_library_path);
} }
void free_resources(Find_Result_Utf8 *result) { void free_resources(Find_Result_Utf8 *result) {
free(result->windows_sdk_root); // gbAllocator a = heap_allocator();
free(result->windows_sdk_um_library_path); // gb_free(a, result->windows_sdk_root.text);
free(result->windows_sdk_ucrt_library_path); // gb_free(a, result->windows_sdk_um_library_path.text);
free(result->vs_exe_path); // gb_free(a, result->windows_sdk_ucrt_library_path.text);
free(result->vs_library_path); // gb_free(a, result->vs_exe_path.text);
// gb_free(a, result->vs_library_path.text);
} }
@@ -150,18 +147,6 @@ typedef WCHAR* BSTR;
typedef const WCHAR* LPCOLESTR; typedef const WCHAR* LPCOLESTR;
struct DECLSPEC_UUID("00000000-0000-0000-C000-000000000046") IUnknown
{
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject) = 0;
virtual ULONG STDMETHODCALLTYPE AddRef(void) = 0;
virtual ULONG STDMETHODCALLTYPE Release(void) = 0;
};
extern "C" HRESULT STDAPICALLTYPE CoInitialize(LPVOID pvReserved);
extern "C" HRESULT STDAPICALLTYPE CoCreateInstance(REFCLSID rclsid, IUnknown * pUnkOuter, DWORD dwClsContext, REFIID riid, LPVOID * ppv);
extern "C" void STDAPICALLTYPE SysFreeString(BSTR bstrString);
struct DECLSPEC_UUID("B41463C3-8866-43B5-BC33-2B0676F7F42E") DECLSPEC_NOVTABLE ISetupInstance : public IUnknown struct DECLSPEC_UUID("B41463C3-8866-43B5-BC33-2B0676F7F42E") DECLSPEC_NOVTABLE ISetupInstance : public IUnknown
{ {
virtual HRESULT STDMETHODCALLTYPE GetInstanceId(BSTR* pbstrInstanceId) = 0; virtual HRESULT STDMETHODCALLTYPE GetInstanceId(BSTR* pbstrInstanceId) = 0;
@@ -193,7 +178,7 @@ struct DECLSPEC_UUID("42843719-DB4C-46C2-8E7C-64F1816EFD5B") DECLSPEC_NOVTABLE I
// The beginning of the actual code that does things. // The beginning of the actual code that does things.
struct Version_Data { struct Version_Data {
int32_t best_version[4]; // For Windows 8 versions, only two of these numbers are used. i32 best_version[4]; // For Windows 8 versions, only two of these numbers are used.
wchar_t *best_name; wchar_t *best_name;
}; };
@@ -212,21 +197,17 @@ wchar_t *concat(wchar_t *a, wchar_t *b, wchar_t *c = nullptr, wchar_t *d = nullp
// If you don't like that, use a programming language that actually // If you don't like that, use a programming language that actually
// helps you with using custom allocators. Or just edit the code. // helps you with using custom allocators. Or just edit the code.
auto len_a = wcslen(a); isize len_a = string16_len(a);
auto len_b = wcslen(b); isize len_b = string16_len(b);
isize len_c = string16_len(c);
size_t len_c = 0; isize len_d = string16_len(d);
if (c) len_c = wcslen(c);
size_t len_d = 0;
if (d) len_d = wcslen(d);
wchar_t *result = (wchar_t *)malloc((len_a + len_b + len_c + len_d + 1) * 2); wchar_t *result = (wchar_t *)malloc((len_a + len_b + len_c + len_d + 1) * 2);
memcpy(result, a, len_a*2); gb_memmove(result, a, len_a*2);
memcpy(result + len_a, b, len_b*2); gb_memmove(result + len_a, b, len_b*2);
if (c) memcpy(result + len_a + len_b, c, len_c * 2); if (c) gb_memmove(result + len_a + len_b, c, len_c * 2);
if (d) memcpy(result + len_a + len_b + len_c, d, len_d * 2); if (d) gb_memmove(result + len_a + len_b + len_c, d, len_d * 2);
result[len_a + len_b + len_c + len_d] = 0; result[len_a + len_b + len_c + len_d] = 0;
@@ -361,16 +342,20 @@ void find_windows_kit_root(Find_Result *result) {
// Look for a Windows 10 entry. // Look for a Windows 10 entry.
auto windows10_root = find_windows_kit_root(main_key, L"KitsRoot10"); auto windows10_root = find_windows_kit_root(main_key, L"KitsRoot10");
if (windows10_root) { if (windows10_root) {
defer (free(windows10_root)); defer (free(windows10_root));
Version_Data data = {0}; Version_Data data = {0};
auto windows10_lib = concat(windows10_root, L"Lib"); auto windows10_lib = concat(windows10_root, L"Lib");
defer (free(windows10_lib)); defer (free(windows10_lib));
visit_files_w(windows10_lib, &data, win10_best); visit_files_w(windows10_lib, &data, win10_best);
if (data.best_name) { if (data.best_name) {
result->windows_sdk_version = 10; result->windows_sdk_version = 10;
result->windows_sdk_root = data.best_name; result->windows_sdk_root = concat(data.best_name, L"\\");
return; return;
} }
} }
@@ -388,7 +373,7 @@ void find_windows_kit_root(Find_Result *result) {
visit_files_w(windows8_lib, &data, win8_best); visit_files_w(windows8_lib, &data, win8_best);
if (data.best_name) { if (data.best_name) {
result->windows_sdk_version = 8; result->windows_sdk_version = 8;
result->windows_sdk_root = data.best_name; result->windows_sdk_root = concat(data.best_name, L"\\");
return; return;
} }
} }
@@ -397,7 +382,7 @@ void find_windows_kit_root(Find_Result *result) {
} }
void find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *result) { bool find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *result) {
// The name of this procedure is kind of cryptic. Its purpose is // The name of this procedure is kind of cryptic. Its purpose is
// to fight through Microsoft craziness. The things that the fine // to fight through Microsoft craziness. The things that the fine
// Visual Studio team want you to do, JUST TO FIND A SINGLE FOLDER // Visual Studio team want you to do, JUST TO FIND A SINGLE FOLDER
@@ -415,24 +400,25 @@ void find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *res
auto rc = CoInitialize(NULL); auto rc = CoInitialize(NULL);
// "Subsequent valid calls return false." So ignore false. // "Subsequent valid calls return false." So ignore false.
// if rc != S_OK return false; if (rc != S_OK) return false;
GUID my_uid = {0x42843719, 0xDB4C, 0x46C2, {0x8E, 0x7C, 0x64, 0xF1, 0x81, 0x6E, 0xFD, 0x5B}}; GUID my_uid = {0x42843719, 0xDB4C, 0x46C2, {0x8E, 0x7C, 0x64, 0xF1, 0x81, 0x6E, 0xFD, 0x5B}};
GUID CLSID_SetupConfiguration = {0x177F0C4A, 0x1CD3, 0x4DE7, {0xA3, 0x2C, 0x71, 0xDB, 0xBB, 0x9F, 0xA3, 0x6D}}; GUID CLSID_SetupConfiguration = {0x177F0C4A, 0x1CD3, 0x4DE7, {0xA3, 0x2C, 0x71, 0xDB, 0xBB, 0x9F, 0xA3, 0x6D}};
DWORD CLSCTX_INPROC_SERVER = 0x1;
ISetupConfiguration *config = NULL; ISetupConfiguration *config = NULL;
auto hr = CoCreateInstance(CLSID_SetupConfiguration, NULL, CLSCTX_INPROC_SERVER, my_uid, (void **)&config); HRESULT hr = 0;
if (hr != 0) return; hr = CoCreateInstance(CLSID_SetupConfiguration, NULL, CLSCTX_INPROC_SERVER, my_uid, (void **)&config);
if (hr != 0) return false;
defer (config->Release()); defer (config->Release());
IEnumSetupInstances *instances = NULL; IEnumSetupInstances *instances = NULL;
hr = config->EnumInstances(&instances); hr = config->EnumInstances(&instances);
if (hr != 0) return; if (hr != 0) return false;
if (!instances) return; if (!instances) return false;
defer (instances->Release()); defer (instances->Release());
while (1) {
for (;;) {
ULONG found = 0; ULONG found = 0;
ISetupInstance *instance = NULL; ISetupInstance *instance = NULL;
auto hr = instances->Next(1, &instance, &found); auto hr = instances->Next(1, &instance, &found);
@@ -471,14 +457,14 @@ void find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *res
auto version_tail = wcschr(version, '\n'); auto version_tail = wcschr(version, '\n');
if (version_tail) *version_tail = 0; // Stomp the data, because nobody cares about it. if (version_tail) *version_tail = 0; // Stomp the data, because nobody cares about it.
auto library_path = concat(bstr_inst_path, L"\\VC\\Tools\\MSVC\\", version, L"\\lib\\x64"); auto library_path = concat(bstr_inst_path, L"\\VC\\Tools\\MSVC\\", version, L"\\lib\\x64\\");
auto library_file = concat(library_path, L"\\vcruntime.lib"); // @Speed: Could have library_path point to this string, with a smaller count, to save on memory flailing! auto library_file = concat(library_path, L"vcruntime.lib"); // @Speed: Could have library_path point to this string, with a smaller count, to save on memory flailing!
if (os_file_exists(library_file)) { if (os_file_exists(library_file)) {
auto link_exe_path = concat(bstr_inst_path, L"\\VC\\Tools\\MSVC\\", version, L"\\bin\\Hostx64\\x64"); auto link_exe_path = concat(bstr_inst_path, L"\\VC\\Tools\\MSVC\\", version, L"\\bin\\Hostx64\\x64\\");
result->vs_exe_path = link_exe_path; result->vs_exe_path = link_exe_path;
result->vs_library_path = library_path; result->vs_library_path = library_path;
return; return true;
} }
/* /*
@@ -495,7 +481,7 @@ void find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *res
HKEY vs7_key; HKEY vs7_key;
rc = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7", 0, KEY_QUERY_VALUE | KEY_WOW64_32KEY, &vs7_key); rc = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7", 0, KEY_QUERY_VALUE | KEY_WOW64_32KEY, &vs7_key);
if (rc != S_OK) return; if (rc != S_OK) return false;
defer (RegCloseKey(vs7_key)); defer (RegCloseKey(vs7_key));
// Hardcoded search for 4 prior Visual Studio versions. Is there something better to do here? // Hardcoded search for 4 prior Visual Studio versions. Is there something better to do here?
@@ -514,7 +500,7 @@ void find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *res
} }
auto buffer = (wchar_t *)malloc(cb_data); auto buffer = (wchar_t *)malloc(cb_data);
if (!buffer) return; if (!buffer) return false;
defer (free(buffer)); defer (free(buffer));
rc = RegQueryValueExW(vs7_key, v, NULL, NULL, (LPBYTE)buffer, &cb_data); rc = RegQueryValueExW(vs7_key, v, NULL, NULL, (LPBYTE)buffer, &cb_data);
@@ -531,55 +517,64 @@ void find_visual_studio_by_fighting_through_microsoft_craziness(Find_Result *res
if (os_file_exists(vcruntime_filename)) { if (os_file_exists(vcruntime_filename)) {
result->vs_exe_path = concat(buffer, L"VC\\bin"); result->vs_exe_path = concat(buffer, L"VC\\bin");
result->vs_library_path = lib_path; result->vs_library_path = lib_path;
return; return true;
} }
free(lib_path); free(lib_path);
} }
// If we get here, we failed to find anything. // If we get here, we failed to find anything.
return false;
} }
Find_Result find_visual_studio_and_windows_sdk() { Find_Result find_visual_studio_and_windows_sdk() {
Find_Result result; Find_Result result = {};
find_windows_kit_root(&result); find_windows_kit_root(&result);
if (result.windows_sdk_root) { if (result.windows_sdk_root) {
result.windows_sdk_um_library_path = concat(result.windows_sdk_root, L"\\um\\x64"); result.windows_sdk_um_library_path = concat(result.windows_sdk_root, L"um\\x64\\");
result.windows_sdk_ucrt_library_path = concat(result.windows_sdk_root, L"\\ucrt\\x64"); result.windows_sdk_ucrt_library_path = concat(result.windows_sdk_root, L"ucrt\\x64\\");
} }
find_visual_studio_by_fighting_through_microsoft_craziness(&result); bool ok = find_visual_studio_by_fighting_through_microsoft_craziness(&result);
if (!ok) {
result.vs_exe_path = concat(L"", L"");
result.vs_library_path = concat(L"", L"");
}
return result; return result;
} }
static char * ucs2_to_utf8(wchar_t * wstr) { String mc_wstring_to_string(wchar_t *str) {
return string16_to_string(mc_allocator, make_string16_c(str));
int len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL) + 1;
char * str = (char*)malloc(len);
WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, len, NULL, NULL);
return str;
} }
Find_Result_Utf8 find_visual_studio_and_windows_sdk_utf8() {
Find_Result_Utf8 find_visual_studio_and_windows_sdk_utf8() {
Find_Result result = find_visual_studio_and_windows_sdk(); Find_Result result = find_visual_studio_and_windows_sdk();
defer (free_resources(&result)); defer (free_resources(&result));
Find_Result_Utf8 r; Find_Result_Utf8 r = {};
r.windows_sdk_version = result.windows_sdk_version; r.windows_sdk_version = result.windows_sdk_version;
r.windows_sdk_root = ucs2_to_utf8(result.windows_sdk_root); r.windows_sdk_root = mc_wstring_to_string(result.windows_sdk_root);
r.windows_sdk_um_library_path = ucs2_to_utf8(result.windows_sdk_um_library_path); r.windows_sdk_um_library_path = mc_wstring_to_string(result.windows_sdk_um_library_path);
r.windows_sdk_ucrt_library_path = ucs2_to_utf8(result.windows_sdk_ucrt_library_path); r.windows_sdk_ucrt_library_path = mc_wstring_to_string(result.windows_sdk_ucrt_library_path);
r.vs_exe_path = ucs2_to_utf8(result.vs_exe_path); r.vs_exe_path = mc_wstring_to_string(result.vs_exe_path);
r.vs_library_path = ucs2_to_utf8(result.vs_library_path); r.vs_library_path = mc_wstring_to_string(result.vs_library_path);
// gb_printf("%.*s\n", LIT(r.windows_sdk_root));
// gb_printf("%.*s\n", LIT(r.windows_sdk_um_library_path));
// gb_printf("%.*s\n", LIT(r.windows_sdk_ucrt_library_path));
// gb_printf("%.*s\n", LIT(r.vs_exe_path));
// gb_printf("%.*s\n", LIT(r.vs_library_path));
// gb_exit(1);
return r; return r;
} }
+17
View File
@@ -207,6 +207,23 @@ gb_inline bool string_ends_with(String const &s, String const &suffix) {
return substring(s, s.len-suffix.len, s.len) == suffix; return substring(s, s.len-suffix.len, s.len) == suffix;
} }
gb_inline bool string_starts_with(String const &s, u8 prefix) {
if (1 > s.len) {
return false;
}
return s[0] == prefix;
}
gb_inline bool string_ends_with(String const &s, u8 suffix) {
if (1 > s.len) {
return false;
}
return s[s.len-1] == suffix;
}
gb_inline isize string_extension_position(String const &str) { gb_inline isize string_extension_position(String const &str) {
isize dot_pos = -1; isize dot_pos = -1;
isize i = str.len; isize i = str.len;