[master] 873c615be Add a function to dump just a subtree
Poul-Henning Kamp
phk at FreeBSD.org
Wed May 22 08:50:15 UTC 2019
commit 873c615be1b07d15e27cba60f9200b90598af644
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed May 22 08:39:17 2019 +0000
Add a function to dump just a subtree
diff --git a/include/vjsn.h b/include/vjsn.h
index ebd4cafc5..5051a6cfa 100644
--- a/include/vjsn.h
+++ b/include/vjsn.h
@@ -58,4 +58,5 @@ struct vjsn *vjsn_parse_end(const char *, const char *, const char **);
struct vjsn *vjsn_parse(const char *, const char **);
void vjsn_delete(struct vjsn **);
void vjsn_dump(const struct vjsn *js, FILE *fo);
+void vjsn_dump_val(const struct vjsn_val *jsv, FILE *fo);
struct vjsn_val *vjsn_child(const struct vjsn_val *, const char *);
diff --git a/lib/libvarnish/vjsn.c b/lib/libvarnish/vjsn.c
index 653fb340d..d9c1a1e53 100644
--- a/lib/libvarnish/vjsn.c
+++ b/lib/libvarnish/vjsn.c
@@ -465,6 +465,7 @@ vjsn_dump_i(const struct vjsn_val *jsv, FILE *fo, int indent)
{
struct vjsn_val *jsve;
+ CHECK_OBJ_NOTNULL(jsv, VJSN_VAL_MAGIC);
printf("%*s", indent, "");
if (jsv->name != NULL)
printf("[\"%s\"]: ", jsv->name);
@@ -482,6 +483,13 @@ vjsn_dump_i(const struct vjsn_val *jsv, FILE *fo, int indent)
vjsn_dump_i(jsve, fo, indent + 2);
}
+void
+vjsn_dump_val(const struct vjsn_val *jsv, FILE *fo)
+{
+ CHECK_OBJ_NOTNULL(jsv, VJSN_VAL_MAGIC);
+ vjsn_dump_i(jsv, fo, 0);
+}
+
void
vjsn_dump(const struct vjsn *js, FILE *fo)
{
More information about the varnish-commit
mailing list