From 68224d108d1e5359a111cb2be0404f6556cb90dd Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 16 Apr 2019 13:47:17 +0200 Subject: include/c: add print_version() macro Let's consolidate the version printing code. It also seems better to use exit() after --version, because it's handled in different way by ASAN. It's strange, but ASAN reports leaks after return in main(). Note that we do not use free-before-exit. Signed-off-by: Karel Zak --- misc-utils/blkid.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'misc-utils') diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c index e94edfcf2..c03e1bb8d 100644 --- a/misc-utils/blkid.c +++ b/misc-utils/blkid.c @@ -62,13 +62,6 @@ struct blkid_control { raw_chars:1; }; -static void print_version(FILE *out) -{ - fprintf(out, _("%s from %s (libblkid %s, %s)\n"), - program_invocation_short_name, PACKAGE_STRING, - LIBBLKID_VERSION, LIBBLKID_DATE); -} - static void __attribute__((__noreturn__)) usage(void) { FILE *out = stdout; @@ -793,7 +786,9 @@ int main(int argc, char **argv) break; case 'V': case 'v': - print_version(stdout); + fprintf(stdout, _("%s from %s (libblkid %s, %s)\n"), + program_invocation_short_name, PACKAGE_STRING, + LIBBLKID_VERSION, LIBBLKID_DATE); err = 0; goto exit; case 'w': -- cgit v1.2.3-55-g7522