summaryrefslogtreecommitdiff
path: root/src/std
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-19 14:33:34 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-07-19 14:33:34 +1000
commit82515f9d90ac149984013f0d64c1cab37b349b29 (patch)
tree6da445874d055e3e66ab1825d4aa3bb784955fc9 /src/std
parent5359c011a08ef2e06ed54104cc16c32868ca88ff (diff)
chore clang format + tidy
Diffstat (limited to 'src/std')
-rw-r--r--src/std/containers/container_utils.h7
-rw-r--r--src/std/containers/darray.h6
-rw-r--r--src/std/containers/hashmap.h3
-rw-r--r--src/std/containers/hashset.h2
-rw-r--r--src/std/mem.h28
5 files changed, 22 insertions, 24 deletions
diff --git a/src/std/containers/container_utils.h b/src/std/containers/container_utils.h
index 39906c3..e1d164c 100644
--- a/src/std/containers/container_utils.h
+++ b/src/std/containers/container_utils.h
@@ -1,18 +1,17 @@
/**
* @file container_utils.h
* @author your name (you@domain.com)
- * @brief
+ * @brief
* @version 0.1
* @date 2024-06-19
- *
+ *
* @copyright Copyright (c) 2024
- *
+ *
*/
#pragma once
typedef struct generic_iterator {
-
} generic_iterator;
typedef void* (*iterator_next_item)(void* iterator); \ No newline at end of file
diff --git a/src/std/containers/darray.h b/src/std/containers/darray.h
index b3dbd06..ebb5795 100644
--- a/src/std/containers/darray.h
+++ b/src/std/containers/darray.h
@@ -86,7 +86,7 @@
size_t new_capacity = \
d->capacity > 0 ? d->capacity * DARRAY_RESIZE_FACTOR : DARRAY_DEFAULT_CAPACITY; \
T *resized = Type##_darray_resize(d, new_capacity); \
- (void)resized; \
+ (void)resized; \
} \
\
d->data[d->len] = value; \
@@ -98,7 +98,7 @@
size_t new_capacity = \
d->capacity > 0 ? d->capacity * DARRAY_RESIZE_FACTOR : DARRAY_DEFAULT_CAPACITY; \
T *resized = Type##_darray_resize(d, new_capacity); \
- (void)resized; \
+ (void)resized; \
} \
\
T *place = d->data + d->len; \
@@ -118,7 +118,7 @@
size_t new_capacity = \
d->capacity > 0 ? d->capacity * DARRAY_RESIZE_FACTOR : DARRAY_DEFAULT_CAPACITY; \
T *resized = Type##_darray_resize(d, new_capacity); \
- (void)resized; \
+ (void)resized; \
} \
\
/* shift existing data after index */ \
diff --git a/src/std/containers/hashmap.h b/src/std/containers/hashmap.h
index 64a5bf7..95c1c6b 100644
--- a/src/std/containers/hashmap.h
+++ b/src/std/containers/hashmap.h
@@ -9,7 +9,6 @@
*
*/
-
typedef struct hashmap hashmap;
/*
@@ -18,7 +17,7 @@ Example usage
init hashmap
insert (string, material)
get (string) -> material_opt or material* ?
-
+
*/
void hashmap_init(hashmap* map);
diff --git a/src/std/containers/hashset.h b/src/std/containers/hashset.h
index 978ec00..7f87213 100644
--- a/src/std/containers/hashset.h
+++ b/src/std/containers/hashset.h
@@ -13,7 +13,7 @@
typedef struct hashset hashset;
-/** @brief Describes a function that will take a pointer to a datatype (e.g. a u64 or a struct)
+/** @brief Describes a function that will take a pointer to a datatype (e.g. a u64 or a struct)
and return a hashed key. */
typedef uint64_t (*hash_item)(void* item);
diff --git a/src/std/mem.h b/src/std/mem.h
index 789cba3..c9346cc 100644
--- a/src/std/mem.h
+++ b/src/std/mem.h
@@ -71,21 +71,21 @@ void void_pool_dealloc(void_pool* pool, u32 raw_handle);
// TODO: macro that lets us specialise
/* typedef struct Name##_handle Name##_handle; \ */
-#define TYPED_POOL(T, Name) \
- typedef struct Name##_pool { \
- void_pool inner; \
- } Name##_pool; \
- \
- static Name##_pool Name##_pool_create(arena* a, u64 cap, u64 entry_size) { \
- void_pool p = void_pool_create(a, "\"" #Name "\"", cap, entry_size); \
- return (Name##_pool){ .inner = p }; \
- } \
+#define TYPED_POOL(T, Name) \
+ typedef struct Name##_pool { \
+ void_pool inner; \
+ } Name##_pool; \
+ \
+ static Name##_pool Name##_pool_create(arena* a, u64 cap, u64 entry_size) { \
+ void_pool p = void_pool_create(a, "\"" #Name "\"", cap, entry_size); \
+ return (Name##_pool){ .inner = p }; \
+ } \
static inline T* Name##_pool_get(Name##_pool* pool, Name##Handle handle) { \
- return (T*)void_pool_get(&pool->inner, handle.raw); \
- } \
+ return (T*)void_pool_get(&pool->inner, handle.raw); \
+ } \
static inline T* Name##_pool_alloc(Name##_pool* pool, Name##Handle* out_handle) { \
- return (T*)void_pool_alloc(&pool->inner, &out_handle->raw); \
- } \
+ return (T*)void_pool_alloc(&pool->inner, &out_handle->raw); \
+ } \
static inline void Name##_pool_dealloc(Name##_pool* pool, Name##Handle handle) { \
- void_pool_dealloc(&pool->inner, handle.raw); \
+ void_pool_dealloc(&pool->inner, handle.raw); \
}\