indent(1): Rearrange option parsing code to squelch clang's static analyzer.
commit275cf09a414856df6fc88c3ef5a17dea2baf1e1b
authorpfg <pfg@FreeBSD.org>
Sun, 31 Jul 2016 21:43:43 +0000 (31 21:43 +0000)
committerpfg <pfg@FreeBSD.org>
Sun, 31 Jul 2016 21:43:43 +0000 (31 21:43 +0000)
tree90939b41dfccd3588634a6f1e572d75573954f18
parentf56b19839226fde3ea8c7b82f138392cb511aaa1
indent(1): Rearrange option parsing code to squelch clang's static analyzer.

clang-analyzer complained that eqin() sets file-scoped pointer param_start
to point into char buffer defined in scan_profile(), and once
scan_profile() exits, param_start is a "dangling reference". param_start
was never used afterwards, but it's cleaner to move it to set_option()
which is the only branch where param_start is needed.

Reference:
https://github.com/pstef/freebsd_indent/commit/ab0e44e5da3ff0fa4b62e451e4bbc3ea1ec7f365

Differential Revision: https://reviews.freebsd.org/D6966  (Partial)
Submitted by: Piotr Stefaniak
usr.bin/indent/args.c