mirror of
https://github.com/json-c/json-c.git
synced 2026-09-10 01:56:50 +08:00
Merge pull request #966 from hilbert149/json_object_array_to_json_string
json_object_array_to_json_string: Hoist array length out of the loop
This commit is contained in:
+3
-2
@@ -1676,10 +1676,11 @@ static int json_object_array_to_json_string(struct json_object *jso, struct prin
|
|||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
int had_children = 0;
|
int had_children = 0;
|
||||||
size_t ii;
|
size_t ii, array_len;
|
||||||
|
|
||||||
printbuf_strappend(pb, "[");
|
printbuf_strappend(pb, "[");
|
||||||
for (ii = 0; ii < json_object_array_length(jso); ii++)
|
array_len = json_object_array_length(jso);
|
||||||
|
for (ii = 0; ii < array_len; ii++)
|
||||||
{
|
{
|
||||||
struct json_object *val;
|
struct json_object *val;
|
||||||
if (had_children)
|
if (had_children)
|
||||||
|
|||||||
Reference in New Issue
Block a user