All of lore.kernel.org
 help / color / mirror / Atom feed
From: li guang <lig.fnst@cn.fujitsu.com>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH v2 3/5] qemu-char: use bool in qemu_chr_open_socket
Date: Thu, 20 Jun 2013 08:21:39 +0800	[thread overview]
Message-ID: <1371687699.31705.60.camel@liguang.fnst.cn.fujitsu.com> (raw)
In-Reply-To: <51C16BB0.7070206@msgid.tls.msk.ru>

在 2013-06-19三的 12:28 +0400,Michael Tokarev写道:
> 18.06.2013 07:45, liguang wrote:
> > local variables is_* should be bool by usage,
> > and last parameter of qemu_opt_get_bool is bool,
> > so pass true/false for it.
> > 
> > Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
> > ---
> >  qemu-char.c |   20 ++++++++++----------
> >  1 files changed, 10 insertions(+), 10 deletions(-)
> > 
> > diff --git a/qemu-char.c b/qemu-char.c
> > index 2c3cfe6..0d695e0 100644
> > --- a/qemu-char.c
> > +++ b/qemu-char.c
> > @@ -2679,16 +2679,16 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts)
> >      CharDriverState *chr = NULL;
> >      Error *local_err = NULL;
> >      int fd = -1;
> > -    int is_listen;
> > -    int is_waitconnect;
> > -    int do_nodelay;
> > -    int is_unix;
> > -    int is_telnet;
> > -
> > -    is_listen      = qemu_opt_get_bool(opts, "server", 0);
> > -    is_waitconnect = qemu_opt_get_bool(opts, "wait", 1);
> > -    is_telnet      = qemu_opt_get_bool(opts, "telnet", 0);
> > -    do_nodelay     = !qemu_opt_get_bool(opts, "delay", 1);
> > +    bool is_listen;
> > +    bool is_waitconnect;
> > +    bool do_nodelay;
> > +    bool is_unix;
> > +    bool is_telnet;
> > +
> > +    is_listen      = qemu_opt_get_bool(opts, "server", false);
> > +    is_waitconnect = qemu_opt_get_bool(opts, "wait", true);
> > +    is_telnet      = qemu_opt_get_bool(opts, "telnet", false);
> > +    do_nodelay     = !qemu_opt_get_bool(opts, "delay", true);
> >      is_unix        = qemu_opt_get(opts, "path") != NULL;
> >      if (!is_listen)
> >          is_waitconnect = 0;
> 
> So is is_waitconnect a booleand or integer? :)

Oh, I'm so lazy to find more...
following is fine for me.

Thanks!

> 
> How about this (I'm unsure about the author anymore ):
> 
> commit c5b775f85f5049d7315b8f8643a65ea1cc7107eb
> Author: liguang <lig.fnst@cn.fujitsu.com>
> Date:   Tue Jun 18 11:45:35 2013 +0800
> 
>     qemu-char: use bool in qemu_chr_open_socket and simplify code a bit
> 
>     Local variables is_* should be bool by usage.
>     While at it, simplify the logic/code a bit.
> 
>     Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
>     Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> 
> diff --git a/qemu-char.c b/qemu-char.c
> index 2c3cfe6..a030e6b 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -2679,19 +2679,12 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts)
>      CharDriverState *chr = NULL;
>      Error *local_err = NULL;
>      int fd = -1;
> -    int is_listen;
> -    int is_waitconnect;
> -    int do_nodelay;
> -    int is_unix;
> -    int is_telnet;
> -
> -    is_listen      = qemu_opt_get_bool(opts, "server", 0);
> -    is_waitconnect = qemu_opt_get_bool(opts, "wait", 1);
> -    is_telnet      = qemu_opt_get_bool(opts, "telnet", 0);
> -    do_nodelay     = !qemu_opt_get_bool(opts, "delay", 1);
> -    is_unix        = qemu_opt_get(opts, "path") != NULL;
> -    if (!is_listen)
> -        is_waitconnect = 0;
> +
> +    bool is_listen      = qemu_opt_get_bool(opts, "server", false);
> +    bool is_waitconnect = is_listen && qemu_opt_get_bool(opts, "wait", true);
> +    bool is_telnet      = qemu_opt_get_bool(opts, "telnet", false);
> +    bool do_nodelay     = !qemu_opt_get_bool(opts, "delay", true);
> +    bool is_unix        = qemu_opt_get(opts, "path") != NULL;
> 
>      if (is_unix) {
>          if (is_listen) {
> 

  reply	other threads:[~2013-06-20  0:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18  3:45 [Qemu-devel] [PATCH v2 1/5] vnc: pass bool parameter for some functions liguang
2013-06-18  3:45 ` [Qemu-devel] [PATCH v2 2/5] vnc: boolize 'skipauth' liguang
2013-06-18  3:45 ` [Qemu-devel] [PATCH v2 3/5] qemu-char: use bool in qemu_chr_open_socket liguang
2013-06-19  8:28   ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-06-20  0:21     ` li guang [this message]
2013-06-18  3:45 ` [Qemu-devel] [PATCH v2 4/5] sd: pass bool parameter for sd_init liguang
2013-06-19  8:30   ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-06-18  3:45 ` [Qemu-devel] [PATCH v2 5/5] ui: boolize 'full_screen' liguang
2013-06-19  8:37   ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2013-06-19  8:17 ` [Qemu-devel] [Qemu-trivial] [PATCH v2 1/5] vnc: pass bool parameter for some functions Michael Tokarev

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=1371687699.31705.60.camel@liguang.fnst.cn.fujitsu.com \
    --to=lig.fnst@cn.fujitsu.com \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.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.