[PATCH] benchtests: Improve readability of JSON output
Florian Weimer
fweimer@redhat.com
Tue Apr 8 09:36:00 GMT 2014
On 04/08/2014 11:28 AM, Will Newton wrote:
> +void
> +json_attr_double (json_ctx_t *ctx, const char *name, double d)
> +{
> + if (!ctx->first_element)
> + {
> + fprintf (ctx->fp, ",\n");
> + }
> +
> + ctx->first_element = false;
> +
> + do_indent (ctx);
> +
> + fprintf (ctx->fp, "\"%s\": %g", name, d);
> +}
Since you posted this, I have to ask: Is there are concise way to
implement this correctly, preserving the actual value of d in the output?
Getting this right is quite a challenge for other (real) JSON libraries.
They are also affected by the locale issue.
--
Florian Weimer / Red Hat Product Security Team
More information about the Libc-alpha
mailing list