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:
7
base.h
7
base.h
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user