forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 958e46acc8e900e8569dd467c1af9b8d2d019394
kernel/tools/bpf/bpftool/json_writer.c
....@@ -1,13 +1,9 @@
1
+// SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause)
12 /*
23 * Simple streaming JSON writer
34 *
45 * This takes care of the annoying bits of JSON syntax like the commas
56 * after elements
6
- *
7
- * This program is free software; you can redistribute it and/or
8
- * modify it under the terms of the GNU General Public License
9
- * as published by the Free Software Foundation; either version
10
- * 2 of the License, or (at your option) any later version.
117 *
128 * Authors: Stephen Hemminger <stephen@networkplumber.org>
139 */
....@@ -123,6 +119,12 @@
123119 self->pretty = on;
124120 }
125121
122
+void jsonw_reset(json_writer_t *self)
123
+{
124
+ assert(self->depth == 0);
125
+ self->sep = '\0';
126
+}
127
+
126128 /* Basic blocks */
127129 static void jsonw_begin(json_writer_t *self, int c)
128130 {