finished collaping arena->allocator info code paths

This commit is contained in:
2025-02-10 01:43:33 -05:00
parent fd44c53e57
commit a54d309fbf
10 changed files with 228 additions and 326 deletions
+7 -20
View File
@@ -274,23 +274,10 @@ os_copy_file_path(String8 dst, String8 src)
}
String8
os_full_path_from_path(Arena* arena, String8 path)
os_full_path_from_path__ainfo(AllocatorInfo ainfo, String8 path)
{
char buffer[PATH_MAX] = {0};
TempArena scratch = scratch_begin(&arena, 1); {
String8 path_copy = push_str8_copy(scratch.arena, path);
realpath((char *)path_copy.str, buffer);
}
scratch_end(scratch);
String8 result = push_str8_copy(arena, str8_cstring(buffer));
return result;
}
String8
os_full_path_from_path_alloc(AllocatorInfo ainfo, String8 path)
{
char buffer[PATH_MAX] = {0};
TempArena scratch = scratch_begin_alloc(ainfo); {
TempArena scratch = scratch_begin(ainfo); {
String8 path_copy = push_str8_copy(scratch.arena, path);
realpath((char *)path_copy.str, buffer);
}
@@ -363,15 +350,15 @@ os_file_map_view_close(OS_Handle map, void* ptr, Rng1U64 range) {
//- rjf: directory iteration
OS_FileIter*
os_file_iter_begin(Arena* arena, String8 path, OS_FileIterFlags flags)
os_file_iter_begin__ainfo(AllocatorInfo ainfo, String8 path, OS_FileIterFlags flags)
{
OS_FileIter*
base_iter = push_array(arena, OS_FileIter, 1);
base_iter = alloc_array(ainfo, OS_FileIter, 1);
base_iter->flags = flags;
OS_LNX_FileIter* iter = (OS_LNX_FileIter*)base_iter->memory;
{
String8 path_copy = push_str8_copy(arena, path);
String8 path_copy = str8_copy(arena, path);
iter->dir = opendir((char*)path_copy.str);
iter->path = path_copy;
}
@@ -395,7 +382,7 @@ os_file_iter_next(Arena* arena, OS_FileIter* iter, OS_FileInfo* info_out)
if(good)
{
TempArena scratch = scratch_begin(&arena, 1);
String8 full_path = push_str8f(scratch.arena, "%S/%s", lnx_iter->path, lnx_iter->dp->d_name);
String8 full_path = str8f(scratch.arena, "%S/%s", lnx_iter->path, lnx_iter->dp->d_name);
stat_result = stat((char *)full_path.str, &st);
scratch_end(scratch);
}
@@ -413,7 +400,7 @@ os_file_iter_next(Arena* arena, OS_FileIter* iter, OS_FileInfo* info_out)
// rjf: output & exit, if good & unfiltered
if (good && !filtered)
{
info_out->name = push_str8_copy(arena, str8_cstring(lnx_iter->dp->d_name));
info_out->name = str8_copy(arena, str8_cstring(lnx_iter->dp->d_name));
if (stat_result != -1) {
info_out->props = os_lnx_file_properties_from_stat(&st);
}
+2 -9
View File
@@ -184,16 +184,9 @@ MD_API void* os_lnx_thread_entry_point(void* ptr);
//~ rjf: @os_hooks System/Process Info (Implemented Per-OS)
inline String8
os_get_current_path(Arena* arena) {
os_get_current_path__ainfo(AllocatorInfo ainfo) {
char* cwdir = getcwd(0, 0);
String8 string = push_str8_copy(arena, str8_cstring(cwdir));
return string;
}
inline String8
os_get_current_path(AllocatorInfo ainfo) {
char* cwdir = getcwd(0, 0);
String8 string = alloc_str8_copy(ainfo, str8_cstring(cwdir));
String8 string = str8_copy(ainfo, str8_cstring(cwdir));
return string;
}
+82 -111
View File
@@ -1,8 +1,9 @@
#ifdef INTELLISENSE_DIRECTIVES
# pragma once
# include "base/file.h"
# include "base/debug.h"
# include "os_resolve.h"
# include "base/strings.h"
# include "base/thread_context.h"
# include "base/file.h"
#endif
// Copyright (c) 2024 Epic Games Tools
@@ -150,38 +151,16 @@ typedef void OS_ThreadFunctionType(void *ptr);
force_inline OS_Handle os_handle_zero (void) { OS_Handle handle = {0}; return handle; }
force_inline B32 os_handle_match(OS_Handle a, OS_Handle b) { return a.u64[0] == b.u64[0]; }
void os_handle_list_push (Arena* arena, OS_HandleList* handles, OS_Handle handle);
void os_handle_list_alloc (AllocatorInfo ainfo, OS_HandleList* handles, OS_Handle handle);
OS_HandleArray os_handle_array_from_list (Arena* arena, OS_HandleList* list);
OS_HandleArray os_handle_array_from_list_alloc(AllocatorInfo ainfo, OS_HandleList* list);
void os_handle_list_push__arena (Arena* arena, OS_HandleList* handles, OS_Handle handle);
void os_handle_list_push__ainfo (AllocatorInfo ainfo, OS_HandleList* handles, OS_Handle handle);
OS_HandleArray os_handle_array_from_list__arena(Arena* arena, OS_HandleList* list);
OS_HandleArray os_handle_array_from_list__ainfo(AllocatorInfo ainfo, OS_HandleList* list);
inline void
os_handle_list_push(Arena* arena, OS_HandleList* handles, OS_Handle handle) {
#if MD_DONT_MAP_ARENA_TO_ALLOCATOR_IMPL
OS_HandleNode* n = push_array(arena, OS_HandleNode, 1);
n->v = handle;
sll_queue_push(handles->first, handles->last, n);
handles->count += 1;
#else
os_handle_list_alloc(arena_allocator(arena), handles, handle);
#endif
}
#define os_handle_ist_push(arena, handles, handle) _Generic(allocator, Arena*: os_handle_list_push__arena, AllocatorInfo: os_handle_list_push__ainfo, default: assert_generic_selection_fail) resolved_function_call(allocator, handles, handle)
#define os_handle_array_from_list(allocator, list) _Generic(allocator, Arena*: os_handle_array_from_list__arena, AllocatorInfo: os_handle_list_push__ainfo, default: assert_generic_selection_fail) resolved_function_call(allocator, list)
inline OS_HandleArray
os_handle_array_from_list(Arena* arena, OS_HandleList* list) {
#if MD_DONT_MAP_ARENA_TO_ALLOCATOR_IMPL
OS_HandleArray result = {0};
result.count = list->count;
result.v = push_array_no_zero(arena, OS_Handle, result.count);
U64 idx = 0;
for(OS_HandleNode* n = list->first; n != 0; n = n->next, idx += 1) {
result.v[idx] = n->v;
}
return result;
#else
return os_handle_array_from_list_alloc(arena_allocator(arena), list);
#endif
}
force_inline void os_handle_list_push__arena (Arena* arena, OS_HandleList* handles, OS_Handle handle) { os_handle_list__push_ainfo (arena_allocator(arena), handles, handle); }
force_inline OS_HandleArray os_handle_array_from_list__arena(Arena* arena, OS_HandleList* list) { return os_handle_array_from_list__ainfo(arena_allocator(arena), list); }
inline void
os_handle_list_alloc(AllocatorInfo ainfo, OS_HandleList* handles, OS_Handle handle) {
@@ -206,44 +185,45 @@ os_handle_array_from_list_alloc(AllocatorInfo ainfo, OS_HandleList* list) {
////////////////////////////////
//~ rjf: Command Line Argc/Argv Helper (Helper, Implemented Once)
String8List os_string_list_from_argcv__arena(Arena* arena, int argc, char** argv);
String8List os_string_list_from_argcv__ainfo(AllocatorInfo ainfo, int argc, char** argv);
inline String8List
os_string_list_from_argcv_alloc(AllocatorInfo ainfo, int argc, char** argv) {
os_string_list_from_argcv__ainfo(AllocatorInfo ainfo, int argc, char** argv) {
String8List result = {0};
for(int i = 0; i < argc; i += 1)
{
String8 str = str8_cstring(argv[i]);
str8_list(ainfo, &result, str);
str8_list_push(ainfo, &result, str);
}
return result;
}
inline String8List
os_string_list_from_argcv(Arena* arena, int argc, char** argv) {
String8List result = {0};
for(int i = 0; i < argc; i += 1)
{
String8 str = str8_cstring(argv[i]);
str8_list_push(arena, &result, str);
}
return result;
}
#define os_string_list_from_argcv(allocator, argc, argv) _Generic(allocator, Arena*: os_string_list_from_argcv__arena, AllocatorInfo: os_string_list_from_argcv__ainfo, default: assert_generic_selection_fail) resolved_function_call(allocator, argc, argv)
force_inline String8List os_string_list_from_argcv__arena(Arena* arena, int argc, char** argv) { return os_string_list_from_argcv__ainfo(arena_allocator(arena), argc, argv); }
////////////////////////////////
//~ rjf: @os_hooks File System (Implemented Per-OS)
//- rjf: files
MD_API OS_Handle os_file_open (OS_AccessFlags flags, String8 path);
MD_API void os_file_close (OS_Handle file);
MD_API U64 os_file_read (OS_Handle file, Rng1U64 rng, void *out_data);
MD_API U64 os_file_write (OS_Handle file, Rng1U64 rng, void *data);
MD_API B32 os_file_set_times (OS_Handle file, DateTime time);
MD_API FileProperties os_properties_from_file (OS_Handle file);
MD_API OS_FileID os_id_from_file (OS_Handle file);
MD_API B32 os_delete_file_at_path (String8 path);
MD_API B32 os_copy_file_path (String8 dst, String8 src);
MD_API String8 os_full_path_from_path (Arena* arena, String8 path);
MD_API B32 os_file_path_exists (String8 path);
MD_API FileProperties os_properties_from_file_path(String8 path);
MD_API OS_Handle os_file_open (OS_AccessFlags flags, String8 path);
MD_API void os_file_close (OS_Handle file);
MD_API U64 os_file_read (OS_Handle file, Rng1U64 rng, void *out_data);
MD_API U64 os_file_write (OS_Handle file, Rng1U64 rng, void *data);
MD_API B32 os_file_set_times (OS_Handle file, DateTime time);
MD_API FileProperties os_properties_from_file (OS_Handle file);
MD_API OS_FileID os_id_from_file (OS_Handle file);
MD_API B32 os_delete_file_at_path (String8 path);
MD_API B32 os_copy_file_path (String8 dst, String8 src);
MD_API B32 os_file_path_exists (String8 path);
MD_API FileProperties os_properties_from_file_path (String8 path);
MD_API String8 os_full_path_from_path__arena(Arena* arena, String8 path);
MD_API String8 os_full_path_from_path__ainfo(AllocatorInfo arena, String8 path);
#define os_full_path_from_path(allocator, path) _Generic(allocator, Arena*: os_full_path_from_path__arena, AllocatorInfo: os_full_path_from_path__ainfo, default: assert_generic_selection_fail) resolved_function_call(allocator, path)
force_inline String8 os_full_path_from_path__arena(Arena* arena, String8 path) { return os_full_path_from_path__ainfo(arena_allocator(arena), path); }
//- rjf: file maps
MD_API OS_Handle os_file_map_open (OS_AccessFlags flags, OS_Handle file);
@@ -252,9 +232,17 @@ MD_API void* os_file_map_view_open (OS_Handle map, OS_AccessFlags flags, Rng
MD_API void os_file_map_view_close(OS_Handle map, void* ptr, Rng1U64 range);
//- rjf: directory iteration
MD_API OS_FileIter* os_file_iter_begin(Arena* arena, String8 path, OS_FileIterFlags flags);
MD_API B32 os_file_iter_next (Arena* arena, OS_FileIter* iter, OS_FileInfo* info_out);
MD_API void os_file_iter_end ( OS_FileIter* iter);
OS_FileIter* os_file_iter_begin__arena(Arena* arena, String8 path, OS_FileIterFlags flags);
MD_API OS_FileIter* os_file_iter_begin__ainfo(AllocatorInfo ainfo, String8 path, OS_FileIterFlags flags);
B32 os_file_iter_next__arena (Arena* arena, OS_FileIter* iter, OS_FileInfo* info_out);
MD_API B32 os_file_iter_next__ainfo (AllocatorInfo arena, OS_FileIter* iter, OS_FileInfo* info_out);
MD_API void os_file_iter_end ( OS_FileIter* iter);
#define os_file_iter_begin(allocator, path, flags) _Generic(allocator, Arena*: os_file_iter_begin__arena, AllocatorInfo: os_file_iter_begin__ainfo, default: assert_generic_selection_fail) resolved_function_call(allocator, path)
#define os_file_iter_next(allocator, iter, info_out) _Generic(allocator, Arena*: os_file_iter_next__arena, AllocatorInfo: os_file_iter_next__ainfo, default: assert_generic_selection_fail) resolved_function_call(allocator, path)
force_inline OS_FileIter* os_file_iter_begin__arena(Arena* arena, String8 path, OS_FileIterFlags flags) { reutrn (); }
force_inline B32 os_file_iter_next__arena (Arena* arena, OS_FileIter* iter, OS_FileInfo* info_out) { reutrn (); }
//- rjf: directory creation
MD_API B32 os_make_directory(String8 path);
@@ -268,36 +256,24 @@ MD_API B32 os_append_data_to_file_path (String8 path, String8 data)
OS_FileID os_id_from_file_path (String8 path);
S64 os_file_id_compare (OS_FileID a, OS_FileID b);
String8 os_data_from_file_path (Arena* arena, String8 path);
String8 os_data_from_file_path_alloc (AllocatorInfo ainfo, String8 path);
MD_API String8 os_string_from_file_range (Arena* arena, OS_Handle file, Rng1U64 range);
MD_API String8 os_string_from_file_range_alloc(AllocatorInfo ainfo, OS_Handle file, Rng1U64 range);
String8 os_data_from_file_path__arena (Arena* arena, String8 path);
String8 os_data_from_file_path__ainfo (AllocatorInfo ainfo, String8 path);
MD_API String8 os_string_from_file_range__arena(Arena* arena, OS_Handle file, Rng1U64 range);
MD_API String8 os_string_from_file_range__ainfo(AllocatorInfo ainfo, OS_Handle file, Rng1U64 range);
#define os_data_from_file_path(allocator, path) _Generic(allocator, Arena*: os_data_from_file_path__arena, AllocatorInfo: os_data_from_file_path__ainfo, default: assert_generic_selection_fail) resolved_function_call(allocator, path)
#define os_string_from_file_range(allocator, file, range) _Generic(allocator, Arena*: os_string_from_file_range__arena, AllocatorInfo: os_string_from_file_range__ainfo, default: assert_generic_selection_fail) resolved_function_call(allocator, file, range)
inline String8
os_data_from_file_path(Arena* arena, String8 path)
{
#if MD_DONT_MAP_ARENA_TO_ALLOCATOR_IMPL
OS_Handle file = os_file_open(OS_AccessFlag_Read | OS_AccessFlag_ShareRead, path);
FileProperties props = os_properties_from_file(file);
String8 data = os_string_from_file_range(arena, file, r1u64(0, props.size));
os_file_close(file);
return data;
#else
return os_data_from_file_path_alloc(arena_allocator(arena), path);
#endif
}
inline String8
os_data_from_file_path_alloc(AllocatorInfo ainfo, String8 path)
os_data_from_file_path__ainfo(AllocatorInfo ainfo, String8 path)
{
OS_Handle file = os_file_open(OS_AccessFlag_Read|OS_AccessFlag_ShareRead, path);
FileProperties props = os_properties_from_file(file);
String8 data = os_string_from_file_range_alloc(ainfo, file, r1u64(0, props.size));
String8 data = os_string_from_file_range(ainfo, file, r1u64(0, props.size));
os_file_close(file);
return data;
}
inline OS_FileID
os_id_from_file_path(String8 path) {
OS_Handle file = os_file_open(OS_AccessFlag_Read | OS_AccessFlag_ShareRead, path);
@@ -311,28 +287,17 @@ inline S64 os_file_id_compare(OS_FileID a, OS_FileID b) { S64 cmp = memory_compa
////////////////////////////////
//~ rjf: GUID Helpers (Helpers, Implemented Once)
inline String8
os_string_from_guid_alloc(AllocatorInfo ainfo, OS_Guid guid) {
String8 result = str8f(ainfo,
"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
guid.data1,
guid.data2,
guid.data3,
guid.data4[0],
guid.data4[1],
guid.data4[2],
guid.data4[3],
guid.data4[4],
guid.data4[5],
guid.data4[6],
guid.data4[7]
);
return result;
}
String8 os_string_from_guid__arena(Arena* arena, OS_Guid guid);
String8 os_string_from_guid__ainfo(AllocatorInfo ainfo, OS_Guid guid);
#define os_string_from_guid(allocator, guid) _Generic(allocator, Arena*: os_string_from_guid__arena, AllocatorInfo: os_string_from_guid__ainfo, default: assert_generic_selection_fail) resolved_function_call(allocator, guid)
force_inline String8 os_string_from_guid__arena(Arena* arena, OS_Guid guid) { os_string_from_guid__ainfo(arena_allocator(arena), guid); }
inline String8
os_string_from_guid(Arena* arena, OS_Guid guid) {
String8 result = str8f(arena,
os_string_from_guid_alloc(AllocatorInfo ainfo, OS_Guid guid) {
String8 result = str8f(ainfo,
"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
guid.data1,
guid.data2,
@@ -355,7 +320,12 @@ os_string_from_guid(Arena* arena, OS_Guid guid) {
MD_API OS_SystemInfo* os_get_system_info (void);
MD_API OS_ProcessInfo* os_get_process_info(void);
String8 os_get_current_path(Arena* arena);
String8 os_get_current_path__arena(Arena* arena);
String8 os_get_current_path__ainfo(AllocatorInfo arena);
#define os_get_current_path(allocator) _Generic(allocator, Arena*: os_get_current_path__arena, AllocatorInfo: os_get_current_path__ainfo) resolved_function_call(allocator)
force_inline String8 os_get_current_path__arena(Arena* arena) { return os_get_current_path__ainfo(arena_allocator(arena)); }
////////////////////////////////
//~ rjf: @os_hooks Memory Allocation (Implemented Per-OS)
@@ -373,7 +343,8 @@ B32 os_commit_large (void* ptr, U64 size);
////////////////////////////////
//~ rjf: @os_hooks Thread Info (Implemented Per-OS)
U32 os_tid (void);
U32 os_tid(void);
MD_API void os_set_thread_name(String8 string);
////////////////////////////////
@@ -424,12 +395,12 @@ MD_API void os_mutex_take (OS_Handle mutex);
MD_API void os_mutex_drop (OS_Handle mutex);
//- rjf: reader/writer mutexes
MD_API OS_Handle os_rw_mutex_alloc(void);
MD_API OS_Handle os_rw_mutex_alloc (void);
MD_API void os_rw_mutex_release(OS_Handle rw_mutex);
MD_API void os_rw_mutex_take_r(OS_Handle mutex);
MD_API void os_rw_mutex_drop_r(OS_Handle mutex);
MD_API void os_rw_mutex_take_w(OS_Handle mutex);
MD_API void os_rw_mutex_drop_w(OS_Handle mutex);
MD_API void os_rw_mutex_take_r (OS_Handle mutex);
MD_API void os_rw_mutex_drop_r (OS_Handle mutex);
MD_API void os_rw_mutex_take_w (OS_Handle mutex);
MD_API void os_rw_mutex_drop_w (OS_Handle mutex);
//- rjf: condition variables
MD_API OS_Handle os_condition_variable_alloc (void);
@@ -450,10 +421,10 @@ MD_API B32 os_semaphore_take (OS_Handle semaphore, U64 endt_us);
MD_API void os_semaphore_drop (OS_Handle semaphore);
//- rjf: scope macros
#define OS_MutexScope(mutex) defer_loop( os_mutex_take (mutex), os_mutex_drop (mutex))
#define OS_MutexScopeR(mutex) defer_loop( os_rw_mutex_take_r(mutex), os_rw_mutex_drop_r(mutex))
#define OS_MutexScopeW(mutex) defer_loop( os_rw_mutex_take_w(mutex), os_rw_mutex_drop_w(mutex))
#define OS_MutexScopeRWPromote(mutex) defer_loop((os_rw_mutex_drop_r(mutex), os_rw_mutex_take_w(mutex)), (os_rw_mutex_drop_w(mutex), os_rw_mutex_take_r(mutex)))
#define os_mutex_scope(mutex) defer_loop( os_mutex_take (mutex), os_mutex_drop (mutex))
#define os_mutex_scope_r(mutex) defer_loop( os_rw_mutex_take_r(mutex), os_rw_mutex_drop_r(mutex))
#define os_mutex_scope_W(mutex) defer_loop( os_rw_mutex_take_w(mutex), os_rw_mutex_drop_w(mutex))
#define os_mutex_scope_rw_promote(mutex) defer_loop((os_rw_mutex_drop_r(mutex), os_rw_mutex_take_w(mutex)), (os_rw_mutex_drop_w(mutex), os_rw_mutex_take_r(mutex)))
////////////////////////////////
//~ rjf: @os_hooks Dynamically-Loaded Libraries (Implemented Per-OS)
+11 -10
View File
@@ -1,5 +1,6 @@
#ifdef INTELLISENSE_DIRECTIVES
# include "os_win32.h"
# include "os.h"
#endif
// Copyright (c) 2024 Epic Games Tools
@@ -346,14 +347,14 @@ os_copy_file_path(String8 dst, String8 src)
}
String8
os_full_path_from_path(Arena* arena, String8 path)
os_full_path_from_path__ainfo(AllocatorInfo ainfo, String8 path)
{
TempArena scratch = scratch_begin(&arena, 1);
TempArena scratch = scratch_begin(ainfo);
DWORD buffer_size = MAX_PATH + 1;
U16* buffer = push_array_no_zero(scratch.arena, U16, buffer_size);
String16 path16 = str16_from(scratch.arena, path);
DWORD path16_size = GetFullPathNameW((WCHAR*)path16.str, buffer_size, (WCHAR*)buffer, NULL);
String8 full_path = str8_from(arena, str16(buffer, path16_size));
String8 full_path = str8_from(ainfo, str16(buffer, path16_size));
scratch_end(scratch);
return full_path;
}
@@ -476,15 +477,15 @@ os_file_map_view_close(OS_Handle map, void* ptr, Rng1U64 range) {
//- rjf: directory iteration
OS_FileIter*
os_file_iter_begin(Arena* arena, String8 path, OS_FileIterFlags flags)
os_file_iter_begin__ainfo(AllocatorInfo ainfo, String8 path, OS_FileIterFlags flags)
{
TempArena scratch = scratch_begin(&arena, 1);
TempArena scratch = scratch_begin(ainfo);
String8 path_with_wildcard = str8_cat(scratch.arena, path, str8_lit("\\*"));
String16 path16 = str16_from(scratch.arena, path_with_wildcard);
OS_FileIter*
iter = push_array(arena, OS_FileIter, 1);
iter = alloc_array(ainfo, OS_FileIter, 1);
iter->flags = flags;
OS_W32_FileIter* w32_iter = (OS_W32_FileIter*)iter->memory;
@@ -500,11 +501,11 @@ os_file_iter_begin(Arena* arena, String8 path, OS_FileIterFlags flags)
{
String16 next_drive_string_16 = str16_cstring((U16*)buffer + off);
off += next_drive_string_16.size + 1;
String8 next_drive_string = str8_from(arena, next_drive_string_16);
String8 next_drive_string = str8_from(ainfo, next_drive_string_16);
next_drive_string = str8_chop_last_slash(next_drive_string);
str8_list_push(scratch.arena, &drive_strings, next_drive_string);
}
w32_iter->drive_strings = str8_array_from_list(arena, &drive_strings);
w32_iter->drive_strings = str8_array_from_list(ainfo, &drive_strings);
w32_iter->drive_strings_iter_idx = 0;
}
else
@@ -516,7 +517,7 @@ os_file_iter_begin(Arena* arena, String8 path, OS_FileIterFlags flags)
}
B32
os_file_iter_next(Arena* arena, OS_FileIter* iter, OS_FileInfo* info_out)
os_file_iter_next__ainfo(AllocatorInfo ainfo, OS_FileIter* iter, OS_FileInfo* info_out)
{
B32 result = 0;
@@ -566,7 +567,7 @@ os_file_iter_next(Arena* arena, OS_FileIter* iter, OS_FileInfo* info_out)
// emit if usable
if (usable_file)
{
info_out->name = str8_from(arena, str16_cstring((U16*)file_name));
info_out->name = str8_from(ainfo, str16_cstring((U16*)file_name));
info_out->props.size = (U64)w32_iter->find_data.nFileSizeLow | (((U64)w32_iter->find_data.nFileSizeHigh) << 32);
os_w32_dense_time_from_file_time(&info_out->props.created, &w32_iter->find_data.ftCreationTime);
os_w32_dense_time_from_file_time(&info_out->props.modified, &w32_iter->find_data.ftLastWriteTime);
+1 -15
View File
@@ -164,7 +164,7 @@ MD_API DWORD os_w32_thread_entry_point(void* ptr);
//~ rjf: @os_hooks System/Process Info (Implemented Per-OS)
inline String8
os_get_current_path_alloc(AllocatorInfo ainfo) {
os_get_current_path__ainfo(AllocatorInfo ainfo) {
String8 name;
TempArena scratch = scratch_begin(ainfo);
{
@@ -177,20 +177,6 @@ os_get_current_path_alloc(AllocatorInfo ainfo) {
return name;
}
inline String8
os_get_current_path(Arena* arena) {
String8 name;
TempArena scratch = scratch_begin(&arena, 1);
{
DWORD length = GetCurrentDirectoryW(0, 0);
U16* memory = push_array_no_zero(scratch.arena, U16, length + 1);
length = GetCurrentDirectoryW(length + 1, (WCHAR*)memory);
name = str8_from(arena, str16(memory, length));
}
scratch_end(scratch);
return name;
}
////////////////////////////////
//~ rjf: @os_hooks Memory Allocation (Implemented Per-OS)