Using FindFirstFileA() instead of CreateFileA() to get the file size

Since we already call FindFirstFileA() and it returns the size there is
no need to open/close every file to get it's size
This commit is contained in:
2026-03-10 19:54:52 +01:00
parent 1fa306643f
commit f904337878
5 changed files with 77 additions and 17 deletions

7
base.h
View File

@@ -137,6 +137,11 @@ static void plat_sem_wait(plat_sem *s) {
WaitForSingleObject(s->handle, INFINITE);
}
static b32 plat_sem_trywait(HANDLE sem) {
DWORD r = WaitForSingleObject(sem, 0);
return r == WAIT_OBJECT_0;
}
static void plat_sem_post(plat_sem *s, u32 count) {
ReleaseSemaphore(s->handle, count, NULL);
}
@@ -203,6 +208,8 @@ static void plat_sem_wait(plat_sem *s) {
}
}
static b32 plat_sem_trywait(sem_t *sem) { return sem_trywait(sem) == 0; }
static void plat_sem_post(plat_sem *s, u32 count) {
for (u32 i = 0; i < count; i++) {
sem_post(&s->sem);