From: Petri Lehtinen Date: Sun, 10 Jan 2010 12:39:04 +0000 (+0200) Subject: Use _nocheck functions internally for speed X-Git-Tag: v1.2~11 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=jansson.git;a=commitdiff_plain;h=508873de9bad7019872857c7aa031570f6c1f205 Use _nocheck functions internally for speed There are some places where we copy a string from an existing JSON value. In these cases the string has already been checked for valid UTF-8. --- diff --git a/src/value.c b/src/value.c index 2b97947..e118af1 100644 --- a/src/value.c +++ b/src/value.c @@ -170,7 +170,7 @@ int json_object_update(json_t *object, json_t *other) key = json_object_iter_key(iter); value = json_object_iter_value(iter); - if(json_object_set(object, key, value)) + if(json_object_set_nocheck(object, key, value)) return -1; iter = json_object_iter_next(other, iter); @@ -260,7 +260,7 @@ static json_t *json_object_copy(json_t *object) key = json_object_iter_key(iter); value = json_object_iter_value(iter); - json_object_set(result, key, value); + json_object_set_nocheck(result, key, value); iter = json_object_iter_next(object, iter); } @@ -285,7 +285,7 @@ static json_t *json_object_deep_copy(json_t *object) key = json_object_iter_key(iter); value = json_object_iter_value(iter); - json_object_set(result, key, json_deep_copy(value)); + json_object_set_nocheck(result, key, json_deep_copy(value)); iter = json_object_iter_next(object, iter); } @@ -667,7 +667,7 @@ static int json_string_equal(json_t *string1, json_t *string2) static json_t *json_string_copy(json_t *string) { - return json_string(json_string_value(string)); + return json_string_nocheck(json_string_value(string)); }