hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
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 */
....@@ -84,9 +80,6 @@
8480 case '"':
8581 fputs("\\\"", self->out);
8682 break;
87
- case '\'':
88
- fputs("\\\'", self->out);
89
- break;
9083 default:
9184 putc(*str, self->out);
9285 }
....@@ -123,6 +116,12 @@
123116 self->pretty = on;
124117 }
125118
119
+void jsonw_reset(json_writer_t *self)
120
+{
121
+ assert(self->depth == 0);
122
+ self->sep = '\0';
123
+}
124
+
126125 /* Basic blocks */
127126 static void jsonw_begin(json_writer_t *self, int c)
128127 {