qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 6/9] monitor/hmp-cmds: add 'goto end' to reduce duplicate code.
Date: Thu, 11 Jun 2020 19:56:06 +0100	[thread overview]
Message-ID: <20200611185606.GB2969@work-vm> (raw)
In-Reply-To: <20200603080904.997083-7-maozhongyi@cmss.chinamobile.com>

* Mao Zhongyi (maozhongyi@cmss.chinamobile.com) wrote:
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>

Yes OK; I don't particularly like goto's; especially in these simpler
cases, but it's OK.


Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  monitor/hmp-cmds.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index acdd6baff3..e8cf72eb3a 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -1501,8 +1501,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
>                                  read_only,
>                                  BLOCKDEV_CHANGE_READ_ONLY_MODE_RETAIN, &err);
>              if (err) {
> -                hmp_handle_error(mon, err);
> -                return;
> +                goto end;
>              }
>          }
>  
> @@ -1511,6 +1510,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
>                                     &err);
>      }
>  
> +end:
>      hmp_handle_error(mon, err);
>  }
>  
> @@ -1629,13 +1629,13 @@ void hmp_object_add(Monitor *mon, const QDict *qdict)
>  
>      opts = qemu_opts_from_qdict(qemu_find_opts("object"), qdict, &err);
>      if (err) {
> -        hmp_handle_error(mon, err);
> -        return;
> +        goto end;
>      }
>  
>      obj = user_creatable_add_opts(opts, &err);
>      qemu_opts_del(opts);
>  
> +end:
>      hmp_handle_error(mon, err);
>  
>      if (obj) {
> -- 
> 2.17.1
> 
> 
> 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



  reply	other threads:[~2020-06-11 18:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03  8:08 [PATCH 0/9] monitor/hmp-cmds: small improvements for migration Mao Zhongyi
2020-06-03  8:08 ` [PATCH 1/9] tests/migration: mem leak fix Mao Zhongyi
2020-06-03  8:08 ` [PATCH 2/9] tests/migration: fix unreachable path in stress test Mao Zhongyi
2020-06-03  8:08 ` [PATCH 3/9] monitor/hmp-cmds: add units for migrate_parameters Mao Zhongyi
2020-06-03  8:08 ` [PATCH 4/9] monitor/hmp-cmds: don't silently output when running 'migrate_set_downtime' fails Mao Zhongyi
2020-06-03  8:09 ` [PATCH 5/9] monitor/hmp-cmds: delete redundant Error check before invoke hmp_handle_error() Mao Zhongyi
2020-06-11 18:52   ` Dr. David Alan Gilbert
2020-06-03  8:09 ` [PATCH 6/9] monitor/hmp-cmds: add 'goto end' to reduce duplicate code Mao Zhongyi
2020-06-11 18:56   ` Dr. David Alan Gilbert [this message]
2020-06-03  8:09 ` [PATCH 7/9] monitor/hmp-cmds: improvements for the 'info migrate' Mao Zhongyi
2020-06-11 18:57   ` Dr. David Alan Gilbert
2020-06-03  8:09 ` [PATCH 8/9] docs/xbzrle: update 'cache miss rate' and 'encoding rate' to docs Mao Zhongyi
2020-06-11 19:00   ` Dr. David Alan Gilbert
2020-06-03  8:09 ` [PATCH 9/9] migration/ram: calculate un/encoded_size only when needed Mao Zhongyi
2020-06-11 19:05   ` Dr. David Alan Gilbert
2020-06-12  3:06     ` [PATCH 9/9] migration/ram: calculate un/encoded_size only whenneeded maozy

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=20200611185606.GB2969@work-vm \
    --to=dgilbert@redhat.com \
    --cc=maozhongyi@cmss.chinamobile.com \
    --cc=qemu-devel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).