Thread (2 messages) flat view 2 messages, 2 authors, 2018-02-15

Re: [PATCH iproute2-next] ip: Use single variable to represent -pretty

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2018-02-15 18:58:18

On Thu, 15 Feb 2018 20:31:33 +0200
Serhey Popovych [off-list ref] wrote:
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 <redacted>
---
Looks Good to me.
Not sure it did not show up in my builds.

I am fixing bridge to use similar json/color/pretty flags.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help