aboutsummaryrefslogtreecommitdiffstats
path: root/src/reader.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-03-16 16:21:20 -0400
committerDavid Robillard <d@drobilla.net>2021-03-07 15:32:23 -0500
commita29581d3ba664175c459e20e6c86be09707fde6e (patch)
treed11253ca88b09d7a768740b00332a4d780e3852d /src/reader.h
parent6e856d3e7a9c3162b9af350d5cec8a3f6bb94ee2 (diff)
downloadserd-a29581d3ba664175c459e20e6c86be09707fde6e.tar.gz
serd-a29581d3ba664175c459e20e6c86be09707fde6e.tar.bz2
serd-a29581d3ba664175c459e20e6c86be09707fde6e.zip
Use char* for strings in public API
The constant casting just makes user code a mess, for no benefit.
Diffstat (limited to 'src/reader.h')
-rw-r--r--src/reader.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/reader.h b/src/reader.h
index e5ee2810..30f3f89d 100644
--- a/src/reader.h
+++ b/src/reader.h
@@ -73,7 +73,7 @@ struct SerdReaderImpl {
SerdSyntax syntax;
unsigned next_id;
uint8_t* buf;
- uint8_t* bprefix;
+ char* bprefix;
size_t bprefix_len;
bool strict; ///< True iff strict parsing
bool seen_genid;
@@ -172,11 +172,13 @@ push_byte(SerdReader* reader, Ref ref, const int c)
assert(c != EOF);
SERD_STACK_ASSERT_TOP(reader, ref);
- uint8_t* const s = (uint8_t*)serd_stack_push(&reader->stack, 1);
+ char* const s = (char*)serd_stack_push(&reader->stack, 1);
SerdNode* const node = (SerdNode*)(reader->stack.buf + ref);
+
+ *(uint8_t*)(s - 1) = (uint8_t)c;
+ *s = '\0';
+
++node->n_bytes;
- *(s - 1) = (uint8_t)c;
- *s = '\0';
return SERD_SUCCESS;
}