Skip to content

Commit 662588b

Browse files
author
James McLaughlin
committed
Merge pull request #3 from chessami92/master
Prevent increment order bug on some compilers.
2 parents d7ebc7a + 11f25f6 commit 662588b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

json-builder.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,8 @@ size_t json_measure_ex (json_value * value, json_serialize_opts opts)
593593
MEASURE_NEWLINE();
594594
}
595595

596-
value = value->u.array.values [((json_builder_value *) value)->length_iterated ++];
596+
((json_builder_value *) value)->length_iterated++;
597+
value = value->u.array.values [((json_builder_value *) value)->length_iterated - 1];
597598
continue;
598599

599600
case json_object:
@@ -783,7 +784,8 @@ void json_serialize_ex (json_char * buf, json_value * value, json_serialize_opts
783784
PRINT_NEWLINE();
784785
}
785786

786-
value = value->u.array.values [((json_builder_value *) value)->length_iterated ++];
787+
((json_builder_value *) value)->length_iterated++;
788+
value = value->u.array.values [((json_builder_value *) value)->length_iterated - 1];
787789
continue;
788790

789791
case json_object:

0 commit comments

Comments
 (0)