diff options
author | David Robillard <d@drobilla.net> | 2024-06-22 20:12:17 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-06-22 20:17:06 -0400 |
commit | 503e58d36cd467ce83a7312f55bb8beb4e5e370b (patch) | |
tree | dda8210a6b71665f46c9ed37cf3de72a869407ea | |
parent | d8204ca7482a9a5184cdd99f16f9d47b0cbe1c22 (diff) | |
download | zix-503e58d36cd467ce83a7312f55bb8beb4e5e370b.tar.gz zix-503e58d36cd467ce83a7312f55bb8beb4e5e370b.tar.bz2 zix-503e58d36cd467ce83a7312f55bb8beb4e5e370b.zip |
Clean up whitespace and clang-format configuration
-rw-r--r-- | .clang-format | 8 | ||||
-rw-r--r-- | benchmark/dict_bench.c | 3 | ||||
-rw-r--r-- | test/test_digest.c | 3 | ||||
-rw-r--r-- | test/test_hash.c | 27 |
4 files changed, 27 insertions, 14 deletions
diff --git a/.clang-format b/.clang-format index e8e993c..87070fc 100644 --- a/.clang-format +++ b/.clang-format @@ -19,15 +19,17 @@ IndentPPDirectives: AfterHash KeepEmptyLinesAtTheStartOfBlocks: false SpacesInContainerLiterals: false StatementMacros: + - FALLTHROUGH + - ZIX_ALWAYS_INLINE_FUNC - ZIX_API - ZIX_BEGIN_DECLS - ZIX_CONST_API - - ZIX_CONST_API + - ZIX_CONST_FUNC - ZIX_END_DECLS - ZIX_MALLOC_API + - ZIX_MALLOC_FUNC - ZIX_PURE_API + - ZIX_PURE_FUNC - ZIX_PURE_WIN_API - - ZIX_THREAD_FUNC - - ZIX_UNUSED - _Pragma ... diff --git a/benchmark/dict_bench.c b/benchmark/dict_bench.c index 5d9acd0..279e6ad 100644 --- a/benchmark/dict_bench.c +++ b/benchmark/dict_bench.c @@ -45,7 +45,8 @@ lcg64(const uint64_t i) return (a * i) + c; } -ZIX_PURE_FUNC static const ZixChunk* +ZIX_PURE_FUNC +static const ZixChunk* identity(const ZixChunk* record) { return record; diff --git a/test/test_digest.c b/test/test_digest.c index 7e7e77a..7228f86 100644 --- a/test/test_digest.c +++ b/test/test_digest.c @@ -116,7 +116,8 @@ test_digest_aligned(void) } } -ZIX_PURE_FUNC int +ZIX_PURE_FUNC +int main(void) { test_digest32(); diff --git a/test/test_hash.c b/test/test_hash.c index d257924..3d3ca95 100644 --- a/test/test_hash.c +++ b/test/test_hash.c @@ -47,21 +47,24 @@ test_fail(TestState* const state, const char* fmt, ...) return EXIT_FAILURE; } -ZIX_PURE_FUNC static const char* +ZIX_PURE_FUNC +static const char* identity(const char* record) { return record; } /// Decent hash function using zix_digest (murmur2) -ZIX_PURE_FUNC static size_t +ZIX_PURE_FUNC +static size_t decent_string_hash(const char* const str) { return zix_digest(0U, str, strlen(str)); } /// Terrible hash function from K&R first edition -ZIX_PURE_FUNC static size_t +ZIX_PURE_FUNC +static size_t terrible_string_hash(const char* str) { size_t hash = 0U; @@ -74,7 +77,8 @@ terrible_string_hash(const char* str) return hash; } -ZIX_PURE_FUNC static size_t +ZIX_PURE_FUNC +static size_t string_hash_aligned(const char* const str) { size_t length = strlen(str); @@ -83,19 +87,22 @@ string_hash_aligned(const char* const str) return zix_digest_aligned(0U, str, length); } -ZIX_PURE_FUNC static size_t +ZIX_PURE_FUNC +static size_t string_hash32(const char* const str) { return (size_t)zix_digest32(0U, str, strlen(str)); } -ZIX_PURE_FUNC static size_t +ZIX_PURE_FUNC +static size_t string_hash64(const char* const str) { return (size_t)zix_digest64(0U, str, strlen(str)); } -ZIX_PURE_FUNC static size_t +ZIX_PURE_FUNC +static size_t string_hash32_aligned(const char* const str) { size_t length = strlen(str); @@ -106,7 +113,8 @@ string_hash32_aligned(const char* const str) #if UINTPTR_MAX >= UINT64_MAX -ZIX_PURE_FUNC static size_t +ZIX_PURE_FUNC +static size_t string_hash64_aligned(const char* const str) { size_t length = strlen(str); @@ -290,7 +298,8 @@ stress(ZixAllocator* const allocator, const size_t n_elems) } /// Identity hash function for numeric strings for explicitly hitting cases -ZIX_PURE_FUNC static size_t +ZIX_PURE_FUNC +static size_t identity_index_hash(const char* const str) { return strtoul(str, NULL, 10); |