btrfs-progs: initialize formatter context properly
In cases where the compiler does not initialize the formatter context to all zeros, there could be garbage values left on the depth 0 that is not explicitly initialized. This could lead to mistakenly printing a "," separator before the last closing "}", like { "__header": { "version": "1" }, } Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
8b7d1fc918
commit
29e2dd7a23
|
@ -98,6 +98,7 @@ static void fmt_separator(struct format_ctx *fctx)
|
|||
void fmt_start(struct format_ctx *fctx, const struct rowspec *spec, int width,
|
||||
int indent)
|
||||
{
|
||||
memset(fctx, 0, sizeof(*fctx));
|
||||
fctx->width = width;
|
||||
fctx->indent = indent;
|
||||
fctx->rowspec = spec;
|
||||
|
|
Loading…
Reference in New Issue