| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Simple streaming JSON writer |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * This takes care of the annoying bits of JSON syntax like the commas |
|---|
| 5 | 6 | * 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. |
|---|
| 11 | 7 | * |
|---|
| 12 | 8 | * Authors: Stephen Hemminger <stephen@networkplumber.org> |
|---|
| 13 | 9 | */ |
|---|
| .. | .. |
|---|
| 123 | 119 | self->pretty = on; |
|---|
| 124 | 120 | } |
|---|
| 125 | 121 | |
|---|
| 122 | +void jsonw_reset(json_writer_t *self) |
|---|
| 123 | +{ |
|---|
| 124 | + assert(self->depth == 0); |
|---|
| 125 | + self->sep = '\0'; |
|---|
| 126 | +} |
|---|
| 127 | + |
|---|
| 126 | 128 | /* Basic blocks */ |
|---|
| 127 | 129 | static void jsonw_begin(json_writer_t *self, int c) |
|---|
| 128 | 130 | { |
|---|