diff options
author | David Robillard <d@drobilla.net> | 2023-12-01 20:39:44 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:08 -0500 |
commit | 02d56e83931e53e1cde57247c64d56fda3804f77 (patch) | |
tree | 2d1ac467bc56f4f4f3570497427be32d7e36bd1a /src/read_nquads.c | |
parent | d094448c095a59117febc8bd4687df071ce9759a (diff) | |
download | serd-02d56e83931e53e1cde57247c64d56fda3804f77.tar.gz serd-02d56e83931e53e1cde57247c64d56fda3804f77.tar.bz2 serd-02d56e83931e53e1cde57247c64d56fda3804f77.zip |
[WIP] Tighten up reader node management
[WIP] Broken on 32-bit
This makes the reader stack manipulations stricter, to make the code more
regular and avoid redundant work and bad cache activity. Now, functions that
push node headers and their bodies are responsible for (more or less)
immediately pushing any trailing null bytes required for termination and
alignment.
This makes the writes to the node in the stack more local, ensures nodes are
terminated as early as possible (to reduce the risk of using non-terminated
strings), and avoids the need to calculate aligned stack allocations.
Diffstat (limited to 'src/read_nquads.c')
-rw-r--r-- | src/read_nquads.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/read_nquads.c b/src/read_nquads.c index 6f0120d1..44c29d0a 100644 --- a/src/read_nquads.c +++ b/src/read_nquads.c @@ -4,7 +4,6 @@ #include "read_nquads.h" #include "caret.h" -#include "node.h" #include "read_ntriples.h" #include "reader.h" #include "stack.h" @@ -44,7 +43,7 @@ read_nquads_statement(SerdReader* const reader) } // Preserve the caret for error reporting and read object - SerdCaret orig_caret = reader->source->caret; + SerdCaret orig_caret = reader->source.caret; if ((st = read_nt_object(reader, &ctx.object, &ate_dot)) || (st = skip_horizontal_whitespace(reader))) { return st; @@ -52,7 +51,7 @@ read_nquads_statement(SerdReader* const reader) if (!ate_dot) { if (peek_byte(reader) == '.') { - eat_byte(reader); + skip_byte(reader, '.'); } else { TRY(st, read_graphLabel(reader, &ctx.graph)); skip_horizontal_whitespace(reader); @@ -60,7 +59,6 @@ read_nquads_statement(SerdReader* const reader) } } - serd_node_zero_pad(ctx.object); const SerdStatement statement = { {ctx.subject, ctx.predicate, ctx.object, ctx.graph}, &orig_caret}; |