From 30b28fb5f1a2d00d4a0b644fe88dd7d200231b2d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 24 May 2011 02:21:16 +0000 Subject: 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 --- src/reader.c | 17 +++++++---------- 1 file 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; } -- cgit v1.2.1