summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2024-01-20 15:48:36 +0100
committerMitya Selivanov <automainint@guattari.tech>2024-01-20 15:48:36 +0100
commit8f67059e444ec3b4c943cfd74ffcad39a42cea1a (patch)
tree12ee695c8946f0125a654a46977258c5bd43aed1
parentfabb8df0a0bcb76e27640568c10bdf3ce9653899 (diff)
downloadkit-8f67059e444ec3b4c943cfd74ffcad39a42cea1a.zip
update TODO
-rw-r--r--TODO4
-rw-r--r--source/kit/allocator.c16
-rw-r--r--source/kit/allocator.h4
3 files changed, 9 insertions, 15 deletions
diff --git a/TODO b/TODO
index a6521b6..a8800d9 100644
--- a/TODO
+++ b/TODO
@@ -4,10 +4,6 @@ To-Do
- hmac_sha256 https://github.com/h5p9sl/hmac_sha256
- ecdh https://github.com/kokke/tiny-ECDH-c
- TLS
-- Allocators
- - Memory pool
- - Memory stack
- - Bump
- Data formats
- UTF-8
- JSON
diff --git a/source/kit/allocator.c b/source/kit/allocator.c
index e1446ac..9fd7bad 100644
--- a/source/kit/allocator.c
+++ b/source/kit/allocator.c
@@ -160,6 +160,7 @@ static void *kit_allocate_from_buffer_(kit_allocator_t *alloc,
assert(0);
return NULL;
}
+
#ifndef KIT_ENABLE_CUSTOM_ALLOC_DISPATCH
void *kit_alloc_dispatch(kit_allocator_t *alloc, i32 request,
i64 size, i64 previous_size, void *pointer) {
@@ -186,16 +187,13 @@ void *kit_alloc_dispatch(kit_allocator_t *alloc, i32 request,
#endif
kit_allocator_t kit_alloc_default(void) {
- kit_allocator_t alloc = { .type = KIT_ALLOC_TYPE_DEFAULT,
- .size = 0,
- .data = NULL };
- return alloc;
+ return (kit_allocator_t) { .type = KIT_ALLOC_TYPE_DEFAULT,
+ .size = 0,
+ .data = NULL };
}
kit_allocator_t kit_alloc_buffer(i64 size, void *buffer) {
- kit_allocator_t alloc = { .type = KIT_ALLOC_TYPE_BUFFER,
- .size = size,
- .data = buffer };
-
- return alloc;
+ return (kit_allocator_t) { .type = KIT_ALLOC_TYPE_BUFFER,
+ .size = size,
+ .data = buffer };
}
diff --git a/source/kit/allocator.h b/source/kit/allocator.h
index 9bd6e0c..97e453e 100644
--- a/source/kit/allocator.h
+++ b/source/kit/allocator.h
@@ -10,7 +10,7 @@ extern "C" {
enum {
KIT_ALLOC_TYPE_NONE,
KIT_ALLOC_TYPE_DEFAULT,
- KIT_ALLOC_TYPE_BUFFER
+ KIT_ALLOC_TYPE_BUFFER,
};
enum {
@@ -19,7 +19,7 @@ enum {
KIT_DEALLOCATE,
KIT_REALLOCATE,
KIT_REALLOCATE_ZERO,
- KIT_DEALLOCATE_ALL
+ KIT_DEALLOCATE_ALL,
};
typedef struct {