From d4a5e5c0581aa25ac91e1d3d7d5900f0d7202ed9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 25 Feb 2021 12:12:15 -0500 Subject: Split up serd_internal.h --- src/byte_sink.c | 2 +- src/macros.h | 22 ++++++++++++++++++++++ src/n3.c | 2 +- src/namespaces.h | 23 +++++++++++++++++++++++ src/node.c | 1 + src/reader.c | 3 +-- src/serd_internal.h | 29 ----------------------------- src/static_nodes.h | 2 +- src/system.c | 1 - src/system.h | 2 ++ src/world.c | 2 +- src/writer.c | 2 +- 12 files changed, 54 insertions(+), 37 deletions(-) create mode 100644 src/macros.h create mode 100644 src/namespaces.h delete mode 100644 src/serd_internal.h (limited to 'src') diff --git a/src/byte_sink.c b/src/byte_sink.c index 993fb624..a90f503d 100644 --- a/src/byte_sink.c +++ b/src/byte_sink.c @@ -14,7 +14,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "serd_internal.h" +#include "macros.h" #include "system.h" #include "serd/serd.h" diff --git a/src/macros.h b/src/macros.h new file mode 100644 index 00000000..ac5af149 --- /dev/null +++ b/src/macros.h @@ -0,0 +1,22 @@ +/* + Copyright 2019-2020 David Robillard + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#ifndef SERD_MACROS_H +#define SERD_MACROS_H + +#define MIN(x, y) ((x) < (y) ? (x) : (y)) + +#endif // SERD_MACROS_H diff --git a/src/n3.c b/src/n3.c index a08dd9c0..f3811d18 100644 --- a/src/n3.c +++ b/src/n3.c @@ -15,9 +15,9 @@ */ #include "byte_source.h" +#include "namespaces.h" #include "node.h" #include "reader.h" -#include "serd_internal.h" #include "stack.h" #include "statement.h" #include "string_utils.h" diff --git a/src/namespaces.h b/src/namespaces.h new file mode 100644 index 00000000..e98eb5e1 --- /dev/null +++ b/src/namespaces.h @@ -0,0 +1,23 @@ +/* + Copyright 2011-2020 David Robillard + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#ifndef SERD_NAMESPACES_H +#define SERD_NAMESPACES_H + +#define NS_XSD "http://www.w3.org/2001/XMLSchema#" +#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" + +#endif // SERD_NAMESPACES_H diff --git a/src/node.c b/src/node.c index 0da9d0ed..30f8e982 100644 --- a/src/node.c +++ b/src/node.c @@ -16,6 +16,7 @@ #include "node.h" +#include "namespaces.h" #include "static_nodes.h" #include "string_utils.h" #include "system.h" diff --git a/src/reader.c b/src/reader.c index 8a0b1a1f..b0b35387 100644 --- a/src/reader.c +++ b/src/reader.c @@ -16,8 +16,7 @@ #include "reader.h" -#include "byte_source.h" -#include "serd_internal.h" +#include "namespaces.h" #include "stack.h" #include "statement.h" #include "system.h" diff --git a/src/serd_internal.h b/src/serd_internal.h deleted file mode 100644 index 91ba509c..00000000 --- a/src/serd_internal.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - Copyright 2011-2020 David Robillard - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#ifndef SERD_INTERNAL_H -#define SERD_INTERNAL_H - -#define NS_XSD "http://www.w3.org/2001/XMLSchema#" -#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" - -#define SERD_PAGE_SIZE 4096 - -#ifndef MIN -# define MIN(a, b) (((a) < (b)) ? (a) : (b)) -#endif - -#endif // SERD_INTERNAL_H diff --git a/src/static_nodes.h b/src/static_nodes.h index adbb5849..467d846f 100644 --- a/src/static_nodes.h +++ b/src/static_nodes.h @@ -19,8 +19,8 @@ #include "serd/serd.h" +#include "namespaces.h" #include "node.h" -#include "serd_internal.h" typedef struct StaticNode { SerdNode node; diff --git a/src/system.c b/src/system.c index 323ed62e..caf211f4 100644 --- a/src/system.c +++ b/src/system.c @@ -19,7 +19,6 @@ #include "system.h" #include "serd_config.h" -#include "serd_internal.h" #ifdef _WIN32 # include diff --git a/src/system.h b/src/system.h index f0e6e267..c0e970e0 100644 --- a/src/system.h +++ b/src/system.h @@ -22,6 +22,8 @@ #include #include +#define SERD_PAGE_SIZE 4096 + /// Allocate a buffer aligned to `alignment` bytes SERD_I_MALLOC_FUNC void* diff --git a/src/world.c b/src/world.c index 354331f6..2cbee1a6 100644 --- a/src/world.c +++ b/src/world.c @@ -19,9 +19,9 @@ #include "world.h" #include "cursor.h" +#include "namespaces.h" #include "node.h" #include "serd_config.h" -#include "serd_internal.h" #if defined(USE_POSIX_FADVISE) # include diff --git a/src/writer.c b/src/writer.c index afeee33d..17291c56 100644 --- a/src/writer.c +++ b/src/writer.c @@ -16,10 +16,10 @@ #include "env.h" #include "node.h" -#include "serd_internal.h" #include "sink.h" #include "stack.h" #include "string_utils.h" +#include "system.h" #include "uri_utils.h" #include "world.h" -- cgit v1.2.1