]> git.proxmox.com Git - mirror_iproute2.git/commit
ip: Use single variable to represent -pretty
authorSerhey Popovych <serhe.popovych@gmail.com>
Thu, 15 Feb 2018 18:31:33 +0000 (20:31 +0200)
committerDavid Ahern <dsahern@gmail.com>
Fri, 16 Feb 2018 16:13:36 +0000 (08:13 -0800)
commit5433656705344e552ceffcc1cf4fe0c74a68f05a
tree016d3ae698cf2385626e543d8cdc520e64f325be
parent3ce21b2d8458004c630f549215915cc967dd60b0
ip: Use single variable to represent -pretty

After commit a233caa0aaee ("json: make pretty printing optional") I get
following build failure:

    LINK     rtmon
    ../lib/libutil.a(json_print.o): In function `new_json_obj':
    json_print.c:(.text+0x35): undefined reference to `show_pretty'
    collect2: error: ld returned 1 exit status
    make[1]: *** [rtmon] Error 1
    make: *** [all] Error 2

It is caused by missing show_pretty variable in rtmon.

On the other hand tc/tc.c there are two distinct variables and single
matches() call that handles -pretty option thus setting show_pretty
will never happen. Note that since commit 44dcfe820185 ("Change
formatting of u32 back to default") show_pretty is used in tc/f_u32.c
so this is first place where -pretty introduced.

Furthermore other utilities like misc/ifstat.c and misc/nstat.c define
pretty variable, however only for their own purposes. They both support
JSON output and thus depend show_pretty in new_json_obj().

Assuming above use common variable to represent -pretty option, define
it in utils.c and declare in utils.h that is commonly used. Replace
show_pretty with pretty.

Fixes: a233caa0aaee ("json: make pretty printing optional")
Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
include/json_print.h
ip/ip.c
lib/json_print.c
lib/utils.c
misc/ifstat.c
misc/nstat.c
tc/f_u32.c
tc/tc.c