libbpf: Fix single-line struct definition output in btf_dump
authorAndrii Nakryiko <andrii@kernel.org>
Mon, 12 Dec 2022 21:15:00 +0000 (13:15 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Apr 2023 10:35:10 +0000 (12:35 +0200)
commit8a5342878429f94ac6086e531f9b404be6837c0e
treed08439d144351604ea67c6cf119e625d248e6087
parent71850b5af92da21b4862a9bc55bda61091247d00
libbpf: Fix single-line struct definition output in btf_dump

[ Upstream commit 872aec4b5f635d94111d48ec3c57fbe078d64e7d ]

btf_dump APIs emit unnecessary tabs when emitting struct/union
definition that fits on the single line. Before this patch we'd get:

struct blah {<tab>};

This patch fixes this and makes sure that we get more natural:

struct blah {};

Fixes: 44a726c3f23c ("bpftool: Print newline before '}' for struct with padding only fields")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20221212211505.558851-2-andrii@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/lib/bpf/btf_dump.c