diff options
-rw-r--r-- | serd/serd.h | 6 | ||||
-rw-r--r-- | src/node.c | 4 | ||||
-rw-r--r-- | src/reader.c | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/serd/serd.h b/serd/serd.h index 120273c0..6865a1c7 100644 --- a/serd/serd.h +++ b/serd/serd.h @@ -186,10 +186,10 @@ typedef enum { A syntactic RDF node. */ typedef struct { - SerdType type; + const uint8_t* buf; /**< Buffer */ size_t n_bytes; /**< Size in bytes (including null) */ size_t n_chars; /**< Length in characters */ - const uint8_t* buf; /**< Buffer */ + SerdType type; /**< Node type */ } SerdNode; /** @@ -277,7 +277,7 @@ serd_uri_serialise(const SerdURI* uri, SerdSink sink, void* stream); @{ */ -static const SerdNode SERD_NODE_NULL = { SERD_NOTHING, 0, 0, 0 }; +static const SerdNode SERD_NODE_NULL = { 0, 0, 0, SERD_NOTHING }; /** Make a (shallow) node from @a str. @@ -25,7 +25,7 @@ serd_node_from_string(SerdType type, const uint8_t* buf) { size_t buf_n_bytes; const size_t buf_n_chars = serd_strlen(buf, &buf_n_bytes); - SerdNode ret = { type, buf_n_bytes, buf_n_chars, buf }; + SerdNode ret = { buf, buf_n_bytes, buf_n_chars, type }; return ret; } @@ -105,7 +105,7 @@ serd_node_new_uri(const SerdURI* uri, const SerdURI* base, SerdURI* out) const size_t len = serd_uri_string_length(&abs_uri); uint8_t* buf = malloc(len + 1); - SerdNode node = { SERD_URI, len + 1, len, buf }; // FIXME: UTF-8 + SerdNode node = { buf, len + 1, len, SERD_URI }; // FIXME: UTF-8 uint8_t* ptr = buf; const size_t actual_len = serd_uri_serialise(&abs_uri, string_sink, &ptr); diff --git a/src/reader.c b/src/reader.c index 615f4d46..10b812e9 100644 --- a/src/reader.c +++ b/src/reader.c @@ -288,7 +288,7 @@ public_node_from_ref(SerdReader reader, SerdType type, Ref ref) return SERD_NODE_NULL; } const SerdString* str = deref(reader, ref); - const SerdNode public = { type, str->n_bytes, str->n_chars, str->buf }; + const SerdNode public = { str->buf, str->n_bytes, str->n_chars, type }; return public; } @@ -1484,10 +1484,10 @@ serd_read_state_expand(SerdReadState state, SerdChunk prefix; SerdChunk suffix; serd_env_expand(state->env, node, &prefix, &suffix); - SerdNode ret = { SERD_URI, + SerdNode ret = { NULL, prefix.len + suffix.len + 1, prefix.len + suffix.len, // FIXME: UTF-8 - NULL }; + SERD_URI }; ret.buf = malloc(ret.n_bytes); snprintf((char*)ret.buf, ret.n_bytes, "%s%s", prefix.buf, suffix.buf); return ret; |