C11 %zd is bit overkill here. Especially requiring conditional compile.

This commit is contained in:
Kelvin Lee 2020-11-06 15:51:14 +11:00
parent 38c4b80ab7
commit 638449c43d

View File

@ -90,11 +90,7 @@ void print_json_object(json_t *element, int indent) {
print_json_indent(indent); print_json_indent(indent);
size = json_object_size(element); size = json_object_size(element);
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
printf("JSON Object of %zd pair%s:\n", size, json_plural(size));
#else
printf("JSON Object of %lld pair%s:\n", (long long)size, json_plural(size)); printf("JSON Object of %lld pair%s:\n", (long long)size, json_plural(size));
#endif
json_object_foreach(element, key, value) { json_object_foreach(element, key, value) {
print_json_indent(indent + 2); print_json_indent(indent + 2);
printf("JSON Key: \"%s\"\n", key); printf("JSON Key: \"%s\"\n", key);
@ -107,11 +103,7 @@ void print_json_array(json_t *element, int indent) {
size_t size = json_array_size(element); size_t size = json_array_size(element);
print_json_indent(indent); print_json_indent(indent);
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
printf("JSON Array of %zd element%s:\n", size, json_plural(size));
#else
printf("JSON Array of %lld element%s:\n", (long long)size, json_plural(size)); printf("JSON Array of %lld element%s:\n", (long long)size, json_plural(size));
#endif
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
print_json_aux(json_array_get(element, i), indent + 2); print_json_aux(json_array_get(element, i), indent + 2);
} }