diff options
author | David Robillard <d@drobilla.net> | 2019-01-06 17:04:21 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-01-06 17:04:21 +0100 |
commit | 5807e4a873730fdb245b3c39913fc6acb3779f8a (patch) | |
tree | 0dd771ec001522848c37709a15af8692f9713208 | |
parent | ef51139dfb60850c9ee4f6d9ea4ea7bfbc4aa15a (diff) | |
download | zix-5807e4a873730fdb245b3c39913fc6acb3779f8a.tar.gz zix-5807e4a873730fdb245b3c39913fc6acb3779f8a.tar.bz2 zix-5807e4a873730fdb245b3c39913fc6acb3779f8a.zip |
Clean up includes
40 files changed, 132 insertions, 113 deletions
diff --git a/test/ampatree_test.c b/test/ampatree_test.c index 94379f6..1138b39 100644 --- a/test/ampatree_test.c +++ b/test/ampatree_test.c @@ -14,12 +14,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "zix/ampatree.h" + #include <stdarg.h> #include <stdio.h> #include <string.h> -#include "zix/ampatree.h" - static const char* strings[] = { "http://example.org/foo", "http://example.org/bar", diff --git a/test/bench.h b/test/bench.h index 93d4002..3575633 100644 --- a/test/bench.h +++ b/test/bench.h @@ -16,8 +16,8 @@ #define _POSIX_C_SOURCE 199309L -#include <time.h> #include <sys/time.h> +#include <time.h> static inline double elapsed_s(const struct timespec* start, const struct timespec* end) diff --git a/test/bitset_test.c b/test/bitset_test.c index 0fbbcab..dbb7bd7 100644 --- a/test/bitset_test.c +++ b/test/bitset_test.c @@ -14,11 +14,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "zix/bitset.h" + #include <stdarg.h> #include <stdio.h> -#include "zix/bitset.h" - #define N_BITS 256 #define N_ELEMS (ZIX_BITSET_ELEMS(N_BITS)) diff --git a/test/btree_test.c b/test/btree_test.c index 8257add..93a257f 100644 --- a/test/btree_test.c +++ b/test/btree_test.c @@ -14,12 +14,16 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <limits.h> +#include "zix/btree.h" + +#include "test_malloc.h" + +#include <stdbool.h> +#include <assert.h> #include <stdarg.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> -#include <time.h> #ifdef _MSC_VER # define PRIdPTR "Id" @@ -27,9 +31,6 @@ # include <inttypes.h> #endif -#include "test_malloc.h" -#include "zix/zix.h" - static bool expect_failure = false; // Return a pseudo-pseudo-pseudo-random-ish integer with no duplicates diff --git a/test/dict_bench.c b/test/dict_bench.c index 228d25c..03be89e 100644 --- a/test/dict_bench.c +++ b/test/dict_bench.c @@ -16,20 +16,20 @@ #include "bench.h" -#include <ctype.h> -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <glib.h> - #include "zix/ampatree.h" #include "zix/chunk.h" #include "zix/hash.h" #include "zix/patree.h" #include "zix/trie.h" +#include <glib.h> + +#include <ctype.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + static const unsigned seed = 1; static int diff --git a/test/hash_test.c b/test/hash_test.c index 7da514b..a24ae9c 100644 --- a/test/hash_test.c +++ b/test/hash_test.c @@ -14,13 +14,17 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "test_malloc.h" + +#include "zix/common.h" +#include "zix/hash.h" + #include <stdarg.h> +#include <stdbool.h> +#include <stdint.h> #include <stdio.h> #include <string.h> -#include "test_malloc.h" -#include "zix/hash.h" - static bool expect_failure = false; static const char* strings[] = { diff --git a/test/patree_test.c b/test/patree_test.c index c28ec40..19df93f 100644 --- a/test/patree_test.c +++ b/test/patree_test.c @@ -14,12 +14,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "zix/patree.h" + #include <stdarg.h> #include <stdio.h> #include <string.h> -#include "zix/patree.h" - static const char* strings[] = { "http://example.org/foo", "http://example.org/bar", diff --git a/test/ring_test.c b/test/ring_test.c index c1ab0fd..cabf6d3 100644 --- a/test/ring_test.c +++ b/test/ring_test.c @@ -14,14 +14,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "zix/ring.h" +#include "zix/thread.h" + #include <limits.h> #include <stdarg.h> +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> -#include <string.h> - -#include "zix/ring.h" -#include "zix/thread.h" #define MSG_SIZE 20 diff --git a/test/sem_test.c b/test/sem_test.c index 9dffe1f..ff95664 100644 --- a/test/sem_test.c +++ b/test/sem_test.c @@ -14,14 +14,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <limits.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - #include "zix/sem.h" #include "zix/thread.h" +#include <stdio.h> +#include <stdlib.h> + static ZixSem sem; static unsigned n_signals = 1024; diff --git a/test/sorted_array_test.c b/test/sorted_array_test.c index f1fa9a8..76745cf 100644 --- a/test/sorted_array_test.c +++ b/test/sorted_array_test.c @@ -14,7 +14,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <limits.h> +#include "zix/common.h" +#include "zix/sorted_array.h" + +#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -26,9 +29,6 @@ # include <inttypes.h> #endif -#include "zix/common.h" -#include "zix/sorted_array.h" - static unsigned seed = 1; static int diff --git a/test/strindex_test.c b/test/strindex_test.c index b36f632..f8a5424 100644 --- a/test/strindex_test.c +++ b/test/strindex_test.c @@ -14,12 +14,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "zix/strindex.h" + #include <stdarg.h> #include <stdio.h> #include <string.h> -#include "zix/strindex.h" - static int test_fail(const char* fmt, ...) { diff --git a/test/test_malloc.c b/test/test_malloc.c index 9b430fe..202db30 100644 --- a/test/test_malloc.c +++ b/test/test_malloc.c @@ -16,16 +16,13 @@ #define _GNU_SOURCE +#include "test_malloc.h" + #include <dlfcn.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> -#include <assert.h> -#include <stdio.h> - -#include "test_malloc.h" - static void* (*test_malloc_sys_malloc)(size_t size) = NULL; static size_t test_malloc_n_allocs = 0; diff --git a/test/tree_bench.c b/test/tree_bench.c index 58535e4..df7d703 100644 --- a/test/tree_bench.c +++ b/test/tree_bench.c @@ -16,16 +16,16 @@ #include "bench.h" +#include "zix/zix.h" + +#include <glib.h> + #include <inttypes.h> #include <limits.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> -#include <glib.h> - -#include "zix/zix.h" - // #define BENCH_SORTED_ARRAY 1 // Return a pseudo-pseudo-pseudo-random-ish integer with no duplicates diff --git a/test/tree_test.c b/test/tree_test.c index 29fba58..a32a58f 100644 --- a/test/tree_test.c +++ b/test/tree_test.c @@ -14,7 +14,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <limits.h> +#include "zix/tree.h" + +#include "zix/common.h" + +#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -26,8 +30,6 @@ # include <inttypes.h> #endif -#include "zix/zix.h" - static unsigned seed = 1; static int diff --git a/test/trie_test.c b/test/trie_test.c index 42bf5dc..4ea6d0d 100644 --- a/test/trie_test.c +++ b/test/trie_test.c @@ -14,12 +14,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "zix/trie.h" + #include <stdarg.h> #include <stdio.h> #include <string.h> -#include "zix/trie.h" - static const char* strings[] = { "http://example.org/foo", "http://example.org/bar", diff --git a/zix/ampatree.c b/zix/ampatree.c index 3c62e04..f0a45a3 100644 --- a/zix/ampatree.c +++ b/zix/ampatree.c @@ -16,17 +16,19 @@ #define _XOPEN_SOURCE 500 +#include "zix/ampatree.h" + +#include "zix/bitset.h" +#include "zix/common.h" +#include "zix/trie_util.h" + #include <assert.h> +#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "zix/ampatree.h" -#include "zix/bitset.h" -#include "zix/common.h" -#include "zix/trie_util.h" - #define ZIX_AMPATREE_BITS 256 #define ZIX_AMPATREE_ELEMS (ZIX_BITSET_ELEMS(ZIX_AMPATREE_BITS)) diff --git a/zix/ampatree.h b/zix/ampatree.h index 33e8acf..c7f7eb7 100644 --- a/zix/ampatree.h +++ b/zix/ampatree.h @@ -19,6 +19,8 @@ #include "zix/common.h" +#include <stdio.h> + /** @addtogroup zix @{ diff --git a/zix/bitset.c b/zix/bitset.c index 155fc82..dbb3d63 100644 --- a/zix/bitset.c +++ b/zix/bitset.c @@ -14,12 +14,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <string.h> - -#include <stdio.h> - #include "zix/bitset.h" +#include <string.h> + /** Number of bits per ZixBitset element (ala CHAR_BIT). */ #define ZIX_BITSET_ELEM_BIT (CHAR_BIT * sizeof(ZixBitset)) diff --git a/zix/bitset.h b/zix/bitset.h index 31be3c5..0e31063 100644 --- a/zix/bitset.h +++ b/zix/bitset.h @@ -17,12 +17,13 @@ #ifndef ZIX_BITSET_H #define ZIX_BITSET_H +#include "zix/common.h" + #include <limits.h> +#include <stdbool.h> #include <stddef.h> #include <stdint.h> -#include "zix/common.h" - /** @addtogroup zix @{ diff --git a/zix/btree.c b/zix/btree.c index f337f7d..75ce363 100644 --- a/zix/btree.c +++ b/zix/btree.c @@ -14,14 +14,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "zix/btree.h" + #include <assert.h> #include <stdint.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#include "zix/btree.h" - // #define ZIX_BTREE_DEBUG 1 #ifndef ZIX_BTREE_PAGE_SIZE diff --git a/zix/btree.h b/zix/btree.h index 46daa24..6aca9bf 100644 --- a/zix/btree.h +++ b/zix/btree.h @@ -17,14 +17,13 @@ #ifndef ZIX_BTREE_H #define ZIX_BTREE_H -#include <stddef.h> - #include "zix/common.h" +#include <stdbool.h> +#include <stddef.h> + #ifdef __cplusplus extern "C" { -#else -# include <stdbool.h> #endif /** diff --git a/zix/chunk.c b/zix/chunk.c index 4533b26..d1e7e6c 100644 --- a/zix/chunk.c +++ b/zix/chunk.c @@ -14,11 +14,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <string.h> - #include "zix/chunk.h" + #include "zix/digest.h" +#include <string.h> + ZIX_API uint32_t zix_chunk_hash(const ZixChunk* const chunk) { diff --git a/zix/chunk.h b/zix/chunk.h index 6efa766..162df41 100644 --- a/zix/chunk.h +++ b/zix/chunk.h @@ -17,11 +17,12 @@ #ifndef ZIX_CHUNK_H #define ZIX_CHUNK_H +#include "zix/common.h" + +#include <stdbool.h> #include <stddef.h> #include <stdint.h> -#include "zix/common.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/zix/digest.h b/zix/digest.h index 8c96492..264c918 100644 --- a/zix/digest.h +++ b/zix/digest.h @@ -17,11 +17,11 @@ #ifndef ZIX_DIGEST_H #define ZIX_DIGEST_H +#include "zix/common.h" + #include <stddef.h> #include <stdint.h> -#include "zix/common.h" - #ifdef __cplusplus extern "C" { #endif @@ -14,13 +14,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "zix/hash.h" + #include <assert.h> -#include <stdint.h> #include <stdlib.h> #include <string.h> -#include "zix/hash.h" - /** Primes, each slightly less than twice its predecessor, and as far away from powers of two as possible. @@ -17,11 +17,11 @@ #ifndef ZIX_HASH_H #define ZIX_HASH_H +#include "zix/common.h" + #include <stddef.h> #include <stdint.h> -#include "zix/common.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/zix/patree.c b/zix/patree.c index efb52b5..fe552d8 100644 --- a/zix/patree.c +++ b/zix/patree.c @@ -16,7 +16,13 @@ #define _XOPEN_SOURCE 500 +#include "zix/patree.h" + +#include "zix/common.h" +#include "zix/trie_util.h" + #include <assert.h> +#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -24,10 +30,6 @@ // #define ZIX_TRIE_LINEAR_SEARCH 1 -#include "zix/common.h" -#include "zix/patree.h" -#include "zix/trie_util.h" - typedef size_t n_edges_t; typedef struct { diff --git a/zix/patree.h b/zix/patree.h index 35436c8..406fbf0 100644 --- a/zix/patree.h +++ b/zix/patree.h @@ -19,6 +19,8 @@ #include "zix/common.h" +#include <stdio.h> + /** @addtogroup zix @{ @@ -14,7 +14,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include <stdint.h> +#include "zix/ring.h" + #include <stdlib.h> #include <string.h> @@ -46,8 +47,6 @@ #define ZIX_READ_BARRIER() ZIX_FULL_BARRIER() #define ZIX_WRITE_BARRIER() ZIX_FULL_BARRIER() -#include "zix/ring.h" - struct ZixRingImpl { uint32_t write_head; ///< Read index into buf uint32_t read_head; ///< Write index into buf @@ -19,8 +19,6 @@ #include <stdint.h> -#include "zix/common.h" - #ifdef __cplusplus extern "C" { #endif @@ -17,6 +17,10 @@ #ifndef ZIX_SEM_H #define ZIX_SEM_H +#include "zix/common.h" + +#include <stdbool.h> + #ifdef __APPLE__ # include <mach/mach.h> #elif defined(_WIN32) @@ -27,8 +31,6 @@ # include <errno.h> #endif -#include "zix/common.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/zix/sorted_array.c b/zix/sorted_array.c index f8e785d..8929d35 100644 --- a/zix/sorted_array.c +++ b/zix/sorted_array.c @@ -14,15 +14,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "zix/sorted_array.h" + +#include "zix/common.h" + #include <assert.h> #include <stdint.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#include "zix/common.h" -#include "zix/sorted_array.h" - // #define ZIX_SORTED_ARRAY_DUMP 1 struct ZixSortedArrayImpl { diff --git a/zix/sorted_array.h b/zix/sorted_array.h index c10c2b6..3e94ca5 100644 --- a/zix/sorted_array.h +++ b/zix/sorted_array.h @@ -19,6 +19,9 @@ #include "zix/common.h" +#include <stdbool.h> +#include <stddef.h> + #ifdef __cplusplus extern "C" { #endif diff --git a/zix/strindex.c b/zix/strindex.c index f98b1b0..a502177 100644 --- a/zix/strindex.c +++ b/zix/strindex.c @@ -16,14 +16,15 @@ #define _XOPEN_SOURCE 500 +#include "zix/strindex.h" + +#include "zix/common.h" + #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "zix/common.h" -#include "zix/strindex.h" - typedef struct _ZixStrindexNode { struct _ZixStrindexNode* children; /* Children of this node */ size_t num_children; /* Number of outgoing edges */ diff --git a/zix/thread.h b/zix/thread.h index b007efa..9f05b10 100644 --- a/zix/thread.h +++ b/zix/thread.h @@ -17,6 +17,10 @@ #ifndef ZIX_THREAD_H #define ZIX_THREAD_H +#include "zix/common.h" + +#include <stdbool.h> + #ifdef _WIN32 # include <windows.h> #else @@ -24,12 +28,8 @@ # include <pthread.h> #endif -#include "zix/common.h" - #ifdef __cplusplus extern "C" { -#else -# include <stdbool.h> #endif /** @@ -14,15 +14,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "zix/tree.h" + +#include "zix/common.h" + #include <assert.h> #include <stdint.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#include "zix/common.h" -#include "zix/tree.h" - typedef struct ZixTreeNodeImpl ZixTreeNode; struct ZixTreeImpl { @@ -17,10 +17,11 @@ #ifndef ZIX_TREE_H #define ZIX_TREE_H -#include <stddef.h> - #include "zix/common.h" +#include <stdbool.h> +#include <stddef.h> + #ifdef __cplusplus extern "C" { #endif @@ -16,7 +16,13 @@ #define _XOPEN_SOURCE 500 +#include "zix/trie.h" + +#include "zix/common.h" +#include "zix/trie_util.h" + #include <assert.h> +#include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> @@ -24,10 +30,6 @@ // #define ZIX_TRIE_LINEAR_SEARCH 1 -#include "zix/common.h" -#include "zix/trie.h" -#include "zix/trie_util.h" - //typedef uint_fast8_t n_edges_t; typedef uintptr_t n_edges_t; @@ -19,6 +19,8 @@ #include "zix/common.h" +#include <stdio.h> + /** @addtogroup zix @{ diff --git a/zix/trie_util.h b/zix/trie_util.h index 45cc1f1..e21d9d6 100644 --- a/zix/trie_util.h +++ b/zix/trie_util.h @@ -17,6 +17,9 @@ #ifndef ZIX_TRIE_UTIL_H #define ZIX_TRIE_UTIL_H +#include <assert.h> +#include <stdint.h> + #ifdef __SSE4_2__ # include <smmintrin.h> #endif |