From: Ian Campbell <ian.campbell@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Chao Peng <chao.p.peng@linux.intel.com>,
Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH] tools/xl: Fix build error following c/s f52fbcf7
Date: Thu, 9 Jul 2015 11:47:43 +0100 [thread overview]
Message-ID: <1436438863.23508.107.camel@citrix.com> (raw)
In-Reply-To: <1436438182-16305-1-git-send-email-andrew.cooper3@citrix.com>
On Thu, 2015-07-09 at 11:36 +0100, Andrew Cooper wrote:
> CentOS7 complains that 'ret' might be unused, and indeed this is the case for
> `xl psr-hwinfo --cat`.
>
> The logic for selecting which information to print was rather awkward.
> Introduce a new 'all' which default to true, and is cleared if specific
> options are selected. This allows for a far more clear logic when choosing
> whether to print information or not.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Campbell <Ian.Campbell@citrix.com>
I'll wait a bit before applying to give Chao a chance to have a look.
> CC: Ian Jackson <Ian.Jackson@eu.citrix.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> CC: Chao Peng <chao.p.peng@linux.intel.com>
>
> ---
> NB: Only compile tested.
> ---
> tools/libxl/xl_cmdimpl.c | 20 ++++++--------------
> 1 file changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index eeb3b90..877165a 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -8426,8 +8426,8 @@ int main_psr_cat_show(int argc, char **argv)
>
> int main_psr_hwinfo(int argc, char **argv)
> {
> - int opt, ret;
> - int cmt = 0, cat = 0;
> + int opt, ret = 0;
> + bool all = true, cmt = false, cat = false;
> static struct option opts[] = {
> {"cmt", 0, 0, 'm'},
> {"cat", 0, 0, 'a'},
> @@ -8437,25 +8437,17 @@ int main_psr_hwinfo(int argc, char **argv)
>
> SWITCH_FOREACH_OPT(opt, "ma", opts, "psr-hwinfo", 0) {
> case 'm':
> - cmt = 1;
> + all = false; cmt = true;
> break;
> case 'a':
> - cat = 1;
> + all = false; cat = true;
> break;
> }
>
> - if (!(cmt | cat)) {
> - cmt = 1;
> - cat = 1;
> - }
> -
> - if (cmt)
> + if (!ret && (all || cmt))
> ret = psr_cmt_hwinfo();
>
> - if (ret)
> - return ret;
> -
> - if (cat)
> + if (!ret && (all || cat))
> ret = psr_cat_hwinfo();
>
> return ret;
next prev parent reply other threads:[~2015-07-09 10:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-09 10:36 [PATCH] tools/xl: Fix build error following c/s f52fbcf7 Andrew Cooper
2015-07-09 10:47 ` Ian Campbell [this message]
2015-07-09 13:31 ` Chao Peng
2015-07-09 14:20 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1436438863.23508.107.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=chao.p.peng@linux.intel.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.