From ca7747e16dbcf7395d73f5292394cf37a4748604 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 11 May 2018 11:14:32 +0200 Subject: Clean up includes and improve source file separation --- src/byte_sink.h | 8 +++++--- src/byte_source.c | 10 ++++++++-- src/byte_source.h | 4 +++- src/env.c | 8 +++++--- src/n3.c | 15 +++++++-------- src/node.c | 8 +++++--- src/node.h | 5 ++++- src/reader.c | 11 ++++++----- src/reader.h | 9 +++++++-- src/serd_internal.h | 16 ---------------- src/serdi.c | 15 +++++++-------- src/stack.h | 2 -- src/string.c | 8 +++++--- src/string_utils.h | 6 ++++++ src/uri.c | 6 +++--- src/uri_utils.h | 2 ++ src/world.c | 8 +++++--- src/world.h | 4 +++- src/writer.c | 15 +++++++++------ 19 files changed, 90 insertions(+), 70 deletions(-) (limited to 'src') diff --git a/src/byte_sink.h b/src/byte_sink.h index 64279534..67cbe187 100644 --- a/src/byte_sink.h +++ b/src/byte_sink.h @@ -17,12 +17,14 @@ #ifndef SERD_BYTE_SINK_H #define SERD_BYTE_SINK_H -#include -#include +#include "serd_internal.h" +#include "system.h" #include "serd/serd.h" -#include "system.h" +#include +#include +#include typedef struct SerdByteSinkImpl { SerdSink sink; diff --git a/src/byte_source.c b/src/byte_source.c index 6e11f863..42f7e557 100644 --- a/src/byte_source.c +++ b/src/byte_source.c @@ -14,11 +14,17 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "serd_internal.h" - #include "byte_source.h" #include "system.h" +#include "system.h" + +#include "serd/serd.h" + +#include +#include +#include + static inline SerdStatus serd_byte_source_page(SerdByteSource* source) { diff --git a/src/byte_source.h b/src/byte_source.h index fa016ee5..028add77 100644 --- a/src/byte_source.h +++ b/src/byte_source.h @@ -17,10 +17,12 @@ #ifndef SERD_BYTE_SOURCE_H #define SERD_BYTE_SOURCE_H -#include "serd_internal.h" +#include "serd/serd.h" #include +#include #include +#include #include typedef int (*SerdStreamCloseFunc)(void*); diff --git a/src/env.c b/src/env.c index bdbca16f..c81b62b0 100644 --- a/src/env.c +++ b/src/env.c @@ -14,13 +14,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "serd_internal.h" +#include "node.h" + +#include "serd/serd.h" +#include +#include #include #include -#include "node.h" - typedef struct { SerdNode* name; SerdNode* uri; diff --git a/src/n3.c b/src/n3.c index a0d2ef5e..f504fb75 100644 --- a/src/n3.c +++ b/src/n3.c @@ -14,19 +14,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "node.h" +#include "reader.h" #include "serd_internal.h" +#include "string_utils.h" +#include "uri_utils.h" + +#include "serd/serd.h" #include #include -#include -#include +#include #include -#include -#include - -#include "reader.h" -#include "string_utils.h" -#include "uri_utils.h" #define TRY_THROW(exp) if (!(exp)) goto except; #define TRY_RET(exp) if (!(exp)) return 0; diff --git a/src/node.c b/src/node.c index 13af7ed6..fcea6bea 100644 --- a/src/node.c +++ b/src/node.c @@ -14,17 +14,19 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "node.h" + #include "serd_internal.h" +#include "string_utils.h" #include #include #include +#include +#include #include #include -#include "node.h" -#include "string_utils.h" - #ifdef _WIN32 # ifndef isnan # define isnan(x) _isnan(x) diff --git a/src/node.h b/src/node.h index a9380bcb..025e29de 100644 --- a/src/node.h +++ b/src/node.h @@ -17,7 +17,10 @@ #ifndef SERD_NODE_H #define SERD_NODE_H -#include "serd_internal.h" +#include "serd/serd.h" + +#include +#include struct SerdNodeImpl { size_t n_bytes; /**< Size in bytes (not including null) */ diff --git a/src/reader.c b/src/reader.c index 45ef43bc..1233bb19 100644 --- a/src/reader.c +++ b/src/reader.c @@ -14,19 +14,20 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "reader.h" + #include "serd_internal.h" +#include "system.h" +#include "world.h" + +#include "serd/serd.h" -#include #include #include -#include #include #include #include -#include "reader.h" -#include "system.h" - static SerdStatus serd_reader_prepare(SerdReader* reader); int diff --git a/src/reader.h b/src/reader.h index 2c915ada..abae5d92 100644 --- a/src/reader.h +++ b/src/reader.h @@ -17,12 +17,17 @@ #ifndef SERD_READER_H #define SERD_READER_H -#include "serd_internal.h" - #include "byte_source.h" #include "node.h" #include "stack.h" +#include "serd/serd.h" + +#include +#include +#include +#include + #ifdef SERD_STACK_CHECK # define SERD_STACK_ASSERT_TOP(reader, ref) \ assert(ref == reader->allocs[reader->n_allocs - 1]); diff --git a/src/serd_internal.h b/src/serd_internal.h index c7260101..fda651ae 100644 --- a/src/serd_internal.h +++ b/src/serd_internal.h @@ -17,22 +17,6 @@ #ifndef SERD_INTERNAL_H #define SERD_INTERNAL_H -#define _POSIX_C_SOURCE 200809L /* for posix_memalign and posix_fadvise */ - -#include -#include -#include -#include - -#include "serd/serd.h" -#include "serd_config.h" - -#include "world.h" - -#if defined(HAVE_FILENO) -# include -#endif - #define NS_XSD "http://www.w3.org/2001/XMLSchema#" #define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" diff --git a/src/serdi.c b/src/serdi.c index 9e72737d..ad52de3d 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -14,16 +14,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "serd_internal.h" - -#include -#include -#include -#include - +#include "serd_config.h" #include "string_utils.h" #include "system.h" -#include "world.h" + +#include "serd/serd.h" + +#include +#include +#include #define SERDI_ERROR(msg) fprintf(stderr, "serdi: " msg); #define SERDI_ERRORF(fmt, ...) fprintf(stderr, "serdi: " fmt, __VA_ARGS__); diff --git a/src/stack.h b/src/stack.h index e35041c8..d2445984 100644 --- a/src/stack.h +++ b/src/stack.h @@ -17,8 +17,6 @@ #ifndef SERD_STACK_H #define SERD_STACK_H -#include "serd_internal.h" - #include #include #include diff --git a/src/string.c b/src/string.c index 783d2b3f..0ab6cb4a 100644 --- a/src/string.c +++ b/src/string.c @@ -14,12 +14,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "serd_internal.h" - -#include +#include "string.h" #include "string_utils.h" +#include +#include +#include + const char* serd_strerror(SerdStatus status) { diff --git a/src/string_utils.h b/src/string_utils.h index 939ddde0..ab6ece0e 100644 --- a/src/string_utils.h +++ b/src/string_utils.h @@ -17,7 +17,13 @@ #ifndef SERD_STRING_UTILS_H #define SERD_STRING_UTILS_H +#include "serd/serd.h" + #include +#include +#include +#include +#include /** Unicode replacement character in UTF-8 */ static const uint8_t replacement_char[] = { 0xEF, 0xBF, 0xBD }; diff --git a/src/uri.c b/src/uri.c index cb76fced..b254bea6 100644 --- a/src/uri.c +++ b/src/uri.c @@ -14,13 +14,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "serd_internal.h" +#include "uri_utils.h" + +#include "serd/serd.h" #include #include -#include "uri_utils.h" - // #define URI_DEBUG 1 char* diff --git a/src/uri_utils.h b/src/uri_utils.h index 35430250..a22bc7bf 100644 --- a/src/uri_utils.h +++ b/src/uri_utils.h @@ -19,6 +19,8 @@ #include "string_utils.h" +#include + static inline bool slice_equals(const SerdSlice* a, const SerdSlice* b) { diff --git a/src/world.c b/src/world.c index 62517f88..0457e34f 100644 --- a/src/world.c +++ b/src/world.c @@ -16,17 +16,19 @@ #define _POSIX_C_SOURCE 200809L /* for posix_fadvise */ -#include "serd_internal.h" +#include "world.h" + #include "serd_config.h" +#include #include #include +#include +#include #if defined(HAVE_POSIX_FADVISE) # include #endif -#include "world.h" - FILE* serd_world_fopen(SerdWorld* world, const char* path, const char* mode) { diff --git a/src/world.h b/src/world.h index dab5254d..f35eb96c 100644 --- a/src/world.h +++ b/src/world.h @@ -17,7 +17,9 @@ #ifndef SERD_WORLD_H #define SERD_WORLD_H -#include "serd_internal.h" +#include "serd/serd.h" + +#include struct SerdWorldImpl { SerdErrorSink error_sink; diff --git a/src/writer.c b/src/writer.c index ed8e1e5e..2ee3412a 100644 --- a/src/writer.c +++ b/src/writer.c @@ -14,19 +14,22 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "byte_sink.h" +#include "node.h" #include "serd_internal.h" +#include "stack.h" +#include "string_utils.h" +#include "system.h" +#include "uri_utils.h" +#include "world.h" + +#include "serd/serd.h" #include #include #include #include -#include "byte_sink.h" -#include "node.h" -#include "stack.h" -#include "string_utils.h" -#include "uri_utils.h" - typedef struct { SerdNode* graph; SerdNode* subject; -- cgit v1.2.1