From f4b1ec91cff0a543a8f7e553ab2113a1c31e0d86 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 29 Dec 2018 19:56:13 -0500 Subject: Rename SerdType to SerdNodeType The old name will be even more ambiguous with the increased scope. --- include/serd/serd.h | 8 ++++---- src/node.c | 4 ++-- src/node.h | 4 ++-- src/reader.c | 17 ++++++++++------- src/reader.h | 15 +++++++++------ 5 files changed, 27 insertions(+), 21 deletions(-) diff --git a/include/serd/serd.h b/include/serd/serd.h index 1a577ee4..e177235b 100644 --- a/include/serd/serd.h +++ b/include/serd/serd.h @@ -172,7 +172,7 @@ typedef enum { Turtle](http://www.w3.org/TR/turtle/#grammar-production-BLANK_NODE_LABEL) */ SERD_BLANK = 4 -} SerdType; +} SerdNodeType; /// Flags indicating certain string properties relevant to serialisation typedef enum { @@ -188,7 +188,7 @@ typedef struct { const char* SERD_NULLABLE buf; ///< Value string size_t n_bytes; ///< Size in bytes (excluding null) SerdNodeFlags flags; ///< Node flags (string properties) - SerdType type; ///< Node type + SerdNodeType type; ///< Node type } SerdNode; /// An unterminated immutable slice of a string @@ -423,7 +423,7 @@ static const SerdNode SERD_NODE_NULL = {NULL, 0, 0, SERD_NOTHING}; */ SERD_API SerdNode -serd_node_from_string(SerdType type, const char* SERD_NULLABLE str); +serd_node_from_string(SerdNodeType type, const char* SERD_NULLABLE str); /** Make a (shallow) node from a prefix of `str`. @@ -433,7 +433,7 @@ serd_node_from_string(SerdType type, const char* SERD_NULLABLE str); */ SERD_API SerdNode -serd_node_from_substring(SerdType type, +serd_node_from_substring(SerdNodeType type, const char* SERD_NULLABLE str, size_t len); diff --git a/src/node.c b/src/node.c index 99f15b8a..999e0164 100644 --- a/src/node.c +++ b/src/node.c @@ -39,7 +39,7 @@ #endif SerdNode -serd_node_from_string(SerdType type, const char* str) +serd_node_from_string(SerdNodeType type, const char* str) { if (!str) { return SERD_NODE_NULL; @@ -52,7 +52,7 @@ serd_node_from_string(SerdType type, const char* str) } SerdNode -serd_node_from_substring(SerdType type, const char* str, const size_t len) +serd_node_from_substring(SerdNodeType type, const char* str, const size_t len) { if (!str) { return SERD_NODE_NULL; diff --git a/src/node.h b/src/node.h index 60f460dd..1c37c68d 100644 --- a/src/node.h +++ b/src/node.h @@ -24,7 +24,7 @@ struct SerdNodeImpl { size_t n_bytes; /**< Size in bytes (not including null) */ SerdNodeFlags flags; /**< Node flags (e.g. string properties) */ - SerdType type; /**< Node type */ + SerdNodeType type; /**< Node type */ }; static inline char* @@ -40,7 +40,7 @@ serd_node_buffer_c(const SerdNode* node) } SerdNode* -serd_node_malloc(size_t n_bytes, SerdNodeFlags flags, SerdType type); +serd_node_malloc(size_t n_bytes, SerdNodeFlags flags, SerdNodeType type); void serd_node_set(SerdNode** dst, const SerdNode* src); diff --git a/src/reader.c b/src/reader.c index 143435c1..fa84d7d7 100644 --- a/src/reader.c +++ b/src/reader.c @@ -14,8 +14,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "byte_source.h" #include "reader.h" +#include "byte_source.h" #include "stack.h" #include "system.h" @@ -80,11 +80,11 @@ serd_file_read_byte(void* buf, size_t size, size_t nmemb, void* stream) } Ref -push_node_padded(SerdReader* reader, - size_t maxlen, - SerdType type, - const char* str, - size_t n_bytes) +push_node_padded(SerdReader* reader, + size_t maxlen, + SerdNodeType type, + const char* str, + size_t n_bytes) { void* mem = serd_stack_push_aligned( &reader->stack, sizeof(SerdNode) + maxlen + 1, sizeof(SerdNode)); @@ -107,7 +107,10 @@ push_node_padded(SerdReader* reader, } Ref -push_node(SerdReader* reader, SerdType type, const char* str, size_t n_bytes) +push_node(SerdReader* reader, + SerdNodeType type, + const char* str, + size_t n_bytes) { return push_node_padded(reader, n_bytes, type, str, n_bytes); } diff --git a/src/reader.h b/src/reader.h index 30f3f89d..f12fbf56 100644 --- a/src/reader.h +++ b/src/reader.h @@ -88,14 +88,17 @@ SerdStatus r_err(SerdReader* reader, SerdStatus st, const char* fmt, ...); Ref -push_node_padded(SerdReader* reader, - size_t maxlen, - SerdType type, - const char* str, - size_t n_bytes); +push_node_padded(SerdReader* reader, + size_t maxlen, + SerdNodeType type, + const char* str, + size_t n_bytes); Ref -push_node(SerdReader* reader, SerdType type, const char* str, size_t n_bytes); +push_node(SerdReader* reader, + SerdNodeType type, + const char* str, + size_t n_bytes); SERD_PURE_FUNC size_t genid_size(SerdReader* reader); -- cgit v1.2.1