summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-03-24 23:07:53 +0100
committerMitya Selivanov <automainint@guattari.tech>2023-03-24 23:07:53 +0100
commitffd92e70eaf8d6c1315e7ea442eee825b0a5289d (patch)
tree65cd10d4ec54801904f6215991f9b0d5888b6b2b /source
parentb6179af210b0ed92224506dce0978c20d8d6fba7 (diff)
downloadkit-ffd92e70eaf8d6c1315e7ea442eee825b0a5289d.zip
[win32] Fix alloc dispatch
Diffstat (limited to 'source')
-rw-r--r--source/kit/file.c2
-rw-r--r--source/kit/thread.win32.c9
2 files changed, 6 insertions, 5 deletions
diff --git a/source/kit/file.c b/source/kit/file.c
index f4000b7..cba4e02 100644
--- a/source/kit/file.c
+++ b/source/kit/file.c
@@ -329,7 +329,7 @@ kit_file_size_result_t kit_file_size(kit_str_t const path) {
PREPARE_PATH_BUF_;
#if defined(_WIN32) && !defined(__CYGWIN__)
- HFILE f = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ, NULL,
+ HANDLE f = CreateFileW(buf, GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (f != INVALID_HANDLE_VALUE) {
DWORD high;
diff --git a/source/kit/thread.win32.c b/source/kit/thread.win32.c
index 94f6e89..c17fc66 100644
--- a/source/kit/thread.win32.c
+++ b/source/kit/thread.win32.c
@@ -85,7 +85,7 @@ static unsigned __stdcall impl_thrd_routine(void *p) {
impl_current_thread.thrd = pack_p->thrd;
impl_current_thread.handle_need_close = false;
memcpy(&pack, pack_p, sizeof(impl_thrd_param_t));
- pack.alloc.deallocate(pack.alloc.state, p);
+ kit_alloc_dispatch(pack.alloc, KIT_DEALLOCATE, 0, 0, p);
code = pack.func(pack.arg);
return (unsigned) code;
}
@@ -273,8 +273,9 @@ int thrd_create_with_stack(thrd_t *thr, thrd_start_t func, void *arg,
assert(thr != NULL);
assert(stack_size >= 0 && stack_size < 0x100000000);
kit_allocator_t alloc = kit_alloc_default();
- pack = (impl_thrd_param_t *) alloc.allocate(
- alloc.state, (sizeof(impl_thrd_param_t)));
+
+ pack = (impl_thrd_param_t *) kit_alloc_dispatch(
+ alloc, KIT_ALLOCATE, (sizeof(impl_thrd_param_t)), 0, NULL);
if (!pack)
return thrd_nomem;
pack->func = func;
@@ -284,7 +285,7 @@ int thrd_create_with_stack(thrd_t *thr, thrd_start_t func, void *arg,
impl_thrd_routine, pack, CREATE_SUSPENDED,
NULL);
if (handle == 0) {
- alloc.deallocate(alloc.state, pack);
+ kit_alloc_dispatch(alloc, KIT_DEALLOCATE, 0, 0, pack);
if (errno == EAGAIN || errno == EACCES)
return thrd_nomem;
return thrd_error;