From 5807e4a873730fdb245b3c39913fc6acb3779f8a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 6 Jan 2019 17:04:21 +0100 Subject: Clean up includes --- test/ampatree_test.c | 4 ++-- test/bench.h | 2 +- test/bitset_test.c | 4 ++-- test/btree_test.c | 11 ++++++----- test/dict_bench.c | 16 ++++++++-------- test/hash_test.c | 10 +++++++--- test/patree_test.c | 4 ++-- test/ring_test.c | 8 ++++---- test/sem_test.c | 8 +++----- test/sorted_array_test.c | 8 ++++---- test/strindex_test.c | 4 ++-- test/test_malloc.c | 7 ++----- test/tree_bench.c | 8 ++++---- test/tree_test.c | 8 +++++--- test/trie_test.c | 4 ++-- zix/ampatree.c | 12 +++++++----- zix/ampatree.h | 2 ++ zix/bitset.c | 6 ++---- zix/bitset.h | 5 +++-- zix/btree.c | 5 ++--- zix/btree.h | 7 +++---- zix/chunk.c | 5 +++-- zix/chunk.h | 5 +++-- zix/digest.h | 4 ++-- zix/hash.c | 5 ++--- zix/hash.h | 4 ++-- zix/patree.c | 10 ++++++---- zix/patree.h | 2 ++ zix/ring.c | 5 ++--- zix/ring.h | 2 -- zix/sem.h | 6 ++++-- zix/sorted_array.c | 8 ++++---- zix/sorted_array.h | 3 +++ zix/strindex.c | 7 ++++--- zix/thread.h | 8 ++++---- zix/tree.c | 8 ++++---- zix/tree.h | 5 +++-- zix/trie.c | 10 ++++++---- zix/trie.h | 2 ++ zix/trie_util.h | 3 +++ 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 #include #include -#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 #include +#include 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 #include -#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 +#include "zix/btree.h" + +#include "test_malloc.h" + +#include +#include #include #include #include #include -#include #ifdef _MSC_VER # define PRIdPTR "Id" @@ -27,9 +31,6 @@ # include #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 -#include -#include -#include -#include - -#include - #include "zix/ampatree.h" #include "zix/chunk.h" #include "zix/hash.h" #include "zix/patree.h" #include "zix/trie.h" +#include + +#include +#include +#include +#include +#include + 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 +#include +#include #include #include -#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 #include #include -#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 #include +#include #include #include -#include - -#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 -#include -#include -#include - #include "zix/sem.h" #include "zix/thread.h" +#include +#include + 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 +#include "zix/common.h" +#include "zix/sorted_array.h" + +#include #include #include #include @@ -26,9 +29,6 @@ # include #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 #include #include -#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 #include #include #include -#include -#include - -#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 + #include #include #include #include #include -#include - -#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 +#include "zix/tree.h" + +#include "zix/common.h" + +#include #include #include #include @@ -26,8 +30,6 @@ # include #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 #include #include -#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 +#include #include #include #include #include -#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 + /** @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 - -#include - #include "zix/bitset.h" +#include + /** 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 +#include #include #include -#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 #include -#include #include #include -#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 - #include "zix/common.h" +#include +#include + #ifdef __cplusplus extern "C" { -#else -# include #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 - #include "zix/chunk.h" + #include "zix/digest.h" +#include + 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 #include #include -#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 #include -#include "zix/common.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/zix/hash.c b/zix/hash.c index a588e0a..2577567 100644 --- a/zix/hash.c +++ b/zix/hash.c @@ -14,13 +14,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "zix/hash.h" + #include -#include #include #include -#include "zix/hash.h" - /** Primes, each slightly less than twice its predecessor, and as far away from powers of two as possible. diff --git a/zix/hash.h b/zix/hash.h index 68cbbe6..58e0e23 100644 --- a/zix/hash.h +++ b/zix/hash.h @@ -17,11 +17,11 @@ #ifndef ZIX_HASH_H #define ZIX_HASH_H +#include "zix/common.h" + #include #include -#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 +#include #include #include #include @@ -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 + /** @addtogroup zix @{ diff --git a/zix/ring.c b/zix/ring.c index 3da4f7f..7932f2b 100644 --- a/zix/ring.c +++ b/zix/ring.c @@ -14,7 +14,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include +#include "zix/ring.h" + #include #include @@ -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 diff --git a/zix/ring.h b/zix/ring.h index f7f1893..168f009 100644 --- a/zix/ring.h +++ b/zix/ring.h @@ -19,8 +19,6 @@ #include -#include "zix/common.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/zix/sem.h b/zix/sem.h index 1fea796..67e3c52 100644 --- a/zix/sem.h +++ b/zix/sem.h @@ -17,6 +17,10 @@ #ifndef ZIX_SEM_H #define ZIX_SEM_H +#include "zix/common.h" + +#include + #ifdef __APPLE__ # include #elif defined(_WIN32) @@ -27,8 +31,6 @@ # include #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 #include -#include #include #include -#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 +#include + #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 #include #include #include -#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 + #ifdef _WIN32 # include #else @@ -24,12 +28,8 @@ # include #endif -#include "zix/common.h" - #ifdef __cplusplus extern "C" { -#else -# include #endif /** diff --git a/zix/tree.c b/zix/tree.c index 1646709..5f8b7f6 100644 --- a/zix/tree.c +++ b/zix/tree.c @@ -14,15 +14,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "zix/tree.h" + +#include "zix/common.h" + #include #include -#include #include #include -#include "zix/common.h" -#include "zix/tree.h" - typedef struct ZixTreeNodeImpl ZixTreeNode; struct ZixTreeImpl { diff --git a/zix/tree.h b/zix/tree.h index c18ae3d..64b91f1 100644 --- a/zix/tree.h +++ b/zix/tree.h @@ -17,10 +17,11 @@ #ifndef ZIX_TREE_H #define ZIX_TREE_H -#include - #include "zix/common.h" +#include +#include + #ifdef __cplusplus extern "C" { #endif diff --git a/zix/trie.c b/zix/trie.c index 71fe281..0c90601 100644 --- a/zix/trie.c +++ b/zix/trie.c @@ -16,7 +16,13 @@ #define _XOPEN_SOURCE 500 +#include "zix/trie.h" + +#include "zix/common.h" +#include "zix/trie_util.h" + #include +#include #include #include #include @@ -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; diff --git a/zix/trie.h b/zix/trie.h index 9843460..5e38df6 100644 --- a/zix/trie.h +++ b/zix/trie.h @@ -19,6 +19,8 @@ #include "zix/common.h" +#include + /** @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 +#include + #ifdef __SSE4_2__ # include #endif -- cgit v1.2.1