aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-05-24 02:21:16 +0000
committerDavid Robillard <d@drobilla.net>2011-05-24 02:21:16 +0000
commit30b28fb5f1a2d00d4a0b644fe88dd7d200231b2d (patch)
tree07f4688eb2f8c84b8cb2cc70ae0d2adf28aeb122 /src
parent655d267e9c7bda4551ae94506dc70ab4bf7c3725 (diff)
downloadserd-30b28fb5f1a2d00d4a0b644fe88dd7d200231b2d.tar.gz
serd-30b28fb5f1a2d00d4a0b644fe88dd7d200231b2d.tar.bz2
serd-30b28fb5f1a2d00d4a0b644fe88dd7d200231b2d.zip
Don't call serd_strlen for append_string (which is only used on internal ASCII strings)
git-svn-id: http://svn.drobilla.net/serd/trunk@186 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src')
-rw-r--r--src/reader.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/reader.c b/src/reader.c
index e76e40e1..bdd0ba06 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -246,20 +246,17 @@ push_byte(SerdReader* reader, Ref ref, const uint8_t c)
}
static inline void
-append_string(SerdReader* reader, Ref ref, const uint8_t* suffix)
+append_string(SerdReader* reader, Ref ref, const uint8_t* suffix, size_t len)
{
#ifdef SERD_STACK_CHECK
assert(stack_is_top_string(reader, ref));
#endif
- size_t n_bytes;
- uint32_t flags = 0;
- size_t n_chars = serd_strlen(suffix, &n_bytes, &flags);
- serd_stack_push(&reader->stack, n_bytes);
+ serd_stack_push(&reader->stack, len);
SerdString* const str = deref(reader, ref);
assert(str->n_bytes >= str->n_chars);
- memcpy(str->buf + str->n_bytes, suffix, n_bytes + 1);
- str->n_bytes += n_bytes;
- str->n_chars += n_chars;
+ memcpy(str->buf + str->n_bytes, suffix, len + 1);
+ str->n_bytes += len;
+ str->n_chars += len;
}
static void
@@ -1016,8 +1013,8 @@ blank_id(SerdReader* reader)
}
char num[32];
snprintf(num, sizeof(num), "%u", reader->next_id++);
- append_string(reader, str, (const uint8_t*)"genid");
- append_string(reader, str, (const uint8_t*)num);
+ append_string(reader, str, (const uint8_t*)"genid", 5);
+ append_string(reader, str, (const uint8_t*)num, strlen(num));
return str;
}