diff options
Diffstat (limited to 'src/reader.c')
-rw-r--r-- | src/reader.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/reader.c b/src/reader.c index 5ff2cbd9..00af2095 100644 --- a/src/reader.c +++ b/src/reader.c @@ -48,9 +48,9 @@ set_blank_id(SerdReader* const reader, } size_t -genid_size(const SerdReader* const reader) +genid_length(const SerdReader* const reader) { - return reader->bprefix_len + 1 + 10 + 1; // + "b" + UINT32_MAX + \0 + return reader->bprefix_len + 10; // + "b" + UINT32_MAX } bool @@ -71,17 +71,19 @@ tolerate_status(const SerdReader* const reader, const SerdStatus status) SerdNode* blank_id(SerdReader* const reader) { - SerdNode* ref = - push_node_padded(reader, genid_size(reader), SERD_BLANK, "", 0); + SerdNode* const ref = + push_node_padded(reader, genid_length(reader), SERD_BLANK, "", 0); + if (ref) { - set_blank_id(reader, ref, genid_size(reader)); + set_blank_id(reader, ref, genid_length(reader) + 1); } + return ref; } SerdNode* push_node_padded(SerdReader* const reader, - const size_t maxlen, + const size_t max_length, const SerdNodeType type, const char* const str, const size_t length) @@ -94,7 +96,7 @@ push_node_padded(SerdReader* const reader, *terminator = 0; void* mem = serd_stack_push_aligned( - &reader->stack, sizeof(SerdNode) + maxlen + 1, sizeof(SerdNode)); + &reader->stack, sizeof(SerdNode) + max_length + 1, sizeof(SerdNode)); if (!mem) { return NULL; |