diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/allocator.c | 9 | ||||
-rw-r--r-- | src/btree.c | 9 | ||||
-rw-r--r-- | src/bump_allocator.c | 15 | ||||
-rw-r--r-- | src/errno_status.h | 6 | ||||
-rw-r--r-- | src/path.c | 18 | ||||
-rw-r--r-- | src/path_iter.h | 6 | ||||
-rw-r--r-- | src/posix/filesystem_posix.c | 3 |
7 files changed, 22 insertions, 44 deletions
diff --git a/src/allocator.c b/src/allocator.c index 6c18804..09e3271 100644 --- a/src/allocator.c +++ b/src/allocator.c @@ -15,16 +15,14 @@ #include <stdlib.h> -ZIX_MALLOC_FUNC -static void* +ZIX_MALLOC_FUNC static void* zix_default_malloc(ZixAllocator* const allocator, const size_t size) { (void)allocator; return malloc(size); } -ZIX_MALLOC_FUNC -static void* +ZIX_MALLOC_FUNC static void* zix_default_calloc(ZixAllocator* const allocator, const size_t nmemb, const size_t size) @@ -49,8 +47,7 @@ zix_default_free(ZixAllocator* const allocator, void* const ptr) free(ptr); } -ZIX_MALLOC_FUNC -static void* +ZIX_MALLOC_FUNC static void* zix_default_aligned_alloc(ZixAllocator* const allocator, const size_t alignment, const size_t size) diff --git a/src/btree.c b/src/btree.c index db7f922..66f8a38 100644 --- a/src/btree.c +++ b/src/btree.c @@ -78,8 +78,7 @@ zix_btree_node_new(ZixAllocator* const allocator, const bool leaf) return node; } -ZIX_PURE_FUNC -static ZixBTreeNode* +ZIX_PURE_FUNC static ZixBTreeNode* zix_btree_child(const ZixBTreeNode* const node, const unsigned i) { assert(!node->is_leaf); @@ -394,16 +393,14 @@ zix_btree_leaf_find(const ZixBTree* const t, t->cmp, t->cmp_data, n->data.leaf.vals, n->n_vals, e, equal); } -ZIX_PURE_FUNC -static inline bool +ZIX_PURE_FUNC static inline bool zix_btree_can_remove_from(const ZixBTreeNode* const n) { assert(n->n_vals >= zix_btree_min_vals(n)); return n->n_vals > zix_btree_min_vals(n); } -ZIX_PURE_FUNC -static inline bool +ZIX_PURE_FUNC static inline bool zix_btree_is_full(const ZixBTreeNode* const n) { assert(n->n_vals <= zix_btree_max_vals(n)); diff --git a/src/bump_allocator.c b/src/bump_allocator.c index 924a1c8..8096907 100644 --- a/src/bump_allocator.c +++ b/src/bump_allocator.c @@ -13,8 +13,7 @@ static const size_t min_alignment = sizeof(uintmax_t); -ZIX_PURE_FUNC -static size_t +ZIX_PURE_FUNC static size_t round_up_multiple(const size_t number, const size_t factor) { assert(factor); // Factor must be non-zero @@ -23,8 +22,7 @@ round_up_multiple(const size_t number, const size_t factor) return (number + factor - 1U) & ~(factor - 1U); } -ZIX_MALLOC_FUNC -static void* +ZIX_MALLOC_FUNC static void* zix_bump_malloc(ZixAllocator* const allocator, const size_t size) { ZixBumpAllocator* const state = (ZixBumpAllocator*)allocator; @@ -46,8 +44,7 @@ zix_bump_malloc(ZixAllocator* const allocator, const size_t size) return (void*)((char*)state->buffer + state->last); } -ZIX_MALLOC_FUNC -static void* +ZIX_MALLOC_FUNC static void* zix_bump_calloc(ZixAllocator* const allocator, const size_t nmemb, const size_t size) @@ -91,8 +88,7 @@ zix_bump_free(ZixAllocator* const allocator, void* const ptr) } } -ZIX_MALLOC_FUNC -static void* +ZIX_MALLOC_FUNC static void* zix_bump_aligned_alloc(ZixAllocator* const allocator, const size_t alignment, const size_t size) @@ -138,8 +134,7 @@ zix_bump_aligned_free(ZixAllocator* const allocator, void* const ptr) zix_bump_free(allocator, ptr); } -ZIX_CONST_FUNC -ZixBumpAllocator +ZIX_CONST_FUNC ZixBumpAllocator zix_bump_allocator(const size_t capacity, void* buffer) { const size_t aligned_top = (uintptr_t)buffer % min_alignment; diff --git a/src/errno_status.h b/src/errno_status.h index 2f81e4e..9c147db 100644 --- a/src/errno_status.h +++ b/src/errno_status.h @@ -8,13 +8,11 @@ #include "zix/status.h" /// Return an errno value converted to a status code -ZIX_CONST_FUNC -ZixStatus +ZIX_CONST_FUNC ZixStatus zix_errno_status(int e); /// Return success if `r` is non-zero, or `errno` as a status code otherwise -ZIX_PURE_FUNC -ZixStatus +ZIX_PURE_FUNC ZixStatus zix_errno_status_if(int r); #endif // ZIX_ERRNO_STATUS_H @@ -92,8 +92,7 @@ typedef struct { ZixIndexRange dir; } ZixRootSlices; -ZIX_PURE_FUNC -static ZixRootSlices +ZIX_PURE_FUNC static ZixRootSlices zix_path_root_slices(const char* const path) { // A root name not trailed by a separator has no root directory @@ -128,8 +127,7 @@ zix_string_ranges_equal(const char* const lhs, !strncmp(lhs + lhs_range.begin, rhs + rhs_range.begin, lhs_len)); } -ZIX_PURE_FUNC -static ZixIndexRange +ZIX_PURE_FUNC static ZixIndexRange zix_path_root_path_range(const char* const path) { const ZixRootSlices root = zix_path_root_slices(path); @@ -140,8 +138,7 @@ zix_path_root_path_range(const char* const path) : zix_make_range(root.name.begin, root.name.end + dir_len); } -ZIX_PURE_FUNC -static ZixIndexRange +ZIX_PURE_FUNC static ZixIndexRange zix_path_parent_path_range(const ZixStringView path) { if (!path.length) { @@ -178,8 +175,7 @@ zix_path_parent_path_range(const ZixStringView path) return zix_make_range(root.begin, root.begin + l + 1U - p); } -ZIX_PURE_FUNC -static ZixIndexRange +ZIX_PURE_FUNC static ZixIndexRange zix_path_filename_range(const ZixStringView path) { if (!path.length) { @@ -201,8 +197,7 @@ zix_path_filename_range(const ZixStringView path) return zix_make_range(f, path.length); } -ZIX_PURE_FUNC -static ZixIndexRange +ZIX_PURE_FUNC static ZixIndexRange zix_path_stem_range(const ZixStringView path) { const ZixIndexRange name = zix_path_filename_range(path); @@ -221,8 +216,7 @@ zix_path_stem_range(const ZixStringView path) return zix_is_empty_range(stem) ? name : stem; } -ZIX_PURE_FUNC -static ZixIndexRange +ZIX_PURE_FUNC static ZixIndexRange zix_path_extension_range(const ZixStringView path) { const ZixIndexRange stem = zix_path_stem_range(path); diff --git a/src/path_iter.h b/src/path_iter.h index b3b23e8..f57c6ef 100644 --- a/src/path_iter.h +++ b/src/path_iter.h @@ -20,12 +20,10 @@ typedef struct { ZixPathIterState state; } ZixPathIter; -ZIX_PURE_FUNC -ZixPathIter +ZIX_PURE_FUNC ZixPathIter zix_path_begin(const char* ZIX_NULLABLE path); -ZIX_PURE_FUNC -ZixPathIter +ZIX_PURE_FUNC ZixPathIter zix_path_next(const char* ZIX_NONNULL path, ZixPathIter iter); #endif // ZIX_PATH_ITER_H diff --git a/src/posix/filesystem_posix.c b/src/posix/filesystem_posix.c index be13995..cd53689 100644 --- a/src/posix/filesystem_posix.c +++ b/src/posix/filesystem_posix.c @@ -378,8 +378,7 @@ zix_file_unlock(FILE* const file, const ZixFileLockMode mode) #endif } -ZIX_CONST_FUNC -static ZixFileType +ZIX_CONST_FUNC static ZixFileType stat_file_type(const struct stat* sb) { typedef struct { |