summaryrefslogtreecommitdiff
path: root/benchtests/json-lib.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 19:30:36 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-27 19:30:36 +0000
commit704e05ff173885df6d1d27f381604429f27fd4de (patch)
treefc67caec36bc5ed0c4190cafd38f69850a10ca0a /benchtests/json-lib.c
parentecfe3e291f848cf598309d746619de62ea88fabb (diff)
parent3fcbb67b7949a8b362de5558bf1c6dd7ec5d21cf (diff)
Merge branch 't/tls-threadvar' into refs/top-bases/t/ONSTACK
Diffstat (limited to 'benchtests/json-lib.c')
-rw-r--r--benchtests/json-lib.c64
1 files changed, 63 insertions, 1 deletions
diff --git a/benchtests/json-lib.c b/benchtests/json-lib.c
index 255e8b2b7c..2e44a2be8a 100644
--- a/benchtests/json-lib.c
+++ b/benchtests/json-lib.c
@@ -1,5 +1,5 @@
/* Simple library for printing JSON data.
- Copyright (C) 2014-2016 Free Software Foundation, Inc.
+ Copyright (C) 2014-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -101,6 +101,32 @@ json_attr_string (json_ctx_t *ctx, const char *name, const char *s)
}
void
+json_attr_uint (json_ctx_t *ctx, const char *name, uint64_t d)
+{
+ if (!ctx->first_element)
+ fprintf (ctx->fp, ",\n");
+ else
+ ctx->first_element = false;
+
+ do_indent (ctx);
+
+ fprintf (ctx->fp, "\"%s\": %" PRIu64 , name, d);
+}
+
+void
+json_attr_int (json_ctx_t *ctx, const char *name, int64_t d)
+{
+ if (!ctx->first_element)
+ fprintf (ctx->fp, ",\n");
+ else
+ ctx->first_element = false;
+
+ do_indent (ctx);
+
+ fprintf (ctx->fp, "\"%s\": %" PRId64 , name, d);
+}
+
+void
json_attr_double (json_ctx_t *ctx, const char *name, double d)
{
if (!ctx->first_element)
@@ -137,6 +163,42 @@ json_array_end (json_ctx_t *ctx)
}
void
+json_element_string (json_ctx_t *ctx, const char *s)
+{
+ if (!ctx->first_element)
+ fprintf (ctx->fp, ", \"%s\"", s);
+ else
+ {
+ fprintf (ctx->fp, "\"%s\"", s);
+ ctx->first_element = false;
+ }
+}
+
+void
+json_element_uint (json_ctx_t *ctx, uint64_t d)
+{
+ if (!ctx->first_element)
+ fprintf (ctx->fp, ", %" PRIu64, d);
+ else
+ {
+ fprintf (ctx->fp, "%" PRIu64, d);
+ ctx->first_element = false;
+ }
+}
+
+void
+json_element_int (json_ctx_t *ctx, int64_t d)
+{
+ if (!ctx->first_element)
+ fprintf (ctx->fp, ", %" PRId64, d);
+ else
+ {
+ fprintf (ctx->fp, "%" PRId64, d);
+ ctx->first_element = false;
+ }
+}
+
+void
json_element_double (json_ctx_t *ctx, double d)
{
if (!ctx->first_element)