All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, kwolf@redhat.com, pkrempa@redhat.com,
	"mdroth@linux.vnet.ibm.commdroth"@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH 12/24] qobject: Propagate parse errors through qobject_from_json()
Date: Tue, 28 Feb 2017 13:19:38 -0600	[thread overview]
Message-ID: <f2beae5b-482d-7151-cb7a-1f103e031f3b@redhat.com> (raw)
In-Reply-To: <1488194450-28056-13-git-send-email-armbru@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2989 bytes --]

On 02/27/2017 05:20 AM, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  block.c                            |  2 +-
>  include/qapi/qmp/qjson.h           |  5 +--
>  monitor.c                          |  2 +-
>  qobject/qjson.c                    |  4 +--
>  tests/check-qjson.c                | 62 +++++++++++++++++++-------------------
>  tests/test-visitor-serialization.c |  2 +-
>  6 files changed, 39 insertions(+), 38 deletions(-)
> 

As with 8/24, this would be a good place for the commit message to
mention that this patch adds the parameter and mechanically adjusts
callers with minimal semantic changes, but that later patches will take
advantage of the parameter.

> +++ b/include/qapi/qmp/qjson.h
> @@ -17,8 +17,9 @@
>  #include "qapi/qmp/qobject.h"
>  #include "qapi/qmp/qstring.h"
>  
> -QObject *qobject_from_json(const char *string);
> -QObject *qobject_from_jsonf(const char *string, ...) GCC_FMT_ATTR(1, 2);
> +QObject *qobject_from_json(const char *string, Error **errp);

The real change here, vs.

> +QObject *qobject_from_jsonf(const char *string, ...)
> +    GCC_FMT_ATTR(1, 2);

formatting.  Should the formatting be hoisted earlier in the series,
when you first touch qobject_from_jsonv?

>  QObject *qobject_from_jsonv(const char *string, va_list *ap, Error **errp)
>      GCC_FMT_ATTR(1, 0);

This makes qobject_from_jsonf() and qobject_from_jsonv() asymmetric
(only one of the two can report errors); and looks a bit weird to have a
va_list not as the last argument (as it is, a 'va_list *' argument is
already weird).  If symmetry is important, we can put errp prior to the
.../ap argument (then both forms have an errp pointer).  But I don't
think it matters in the context of this series.  If you DO change it,
though, then 8/24 would be the place to tweak it.

At one point, I posted a series that removed all uses of
qobject_from_json[fv] (leaving just qobject_from_json); at the time,
there was not a strong opinion on whether the series was worthwhile, but
if we want it, I'm fine rebasing on top of this.  (One argument in favor
of my series would be getting rid of the weird 'va_list *' argument).

> +++ b/qobject/qjson.c
> @@ -50,9 +50,9 @@ QObject *qobject_from_jsonv(const char *string, va_list *ap, Error **errp)
>      return state.result;
>  }
>  
> -QObject *qobject_from_json(const char *string)
> +QObject *qobject_from_json(const char *string, Error **errp)
>  {
> -    return qobject_from_jsonv(string, NULL, NULL);
> +    return qobject_from_jsonv(string, NULL, errp);

Of course, if you rebase the series to rearrange where errp appears in
relation to va_list, then be sure this changes to match (the compiler
may or may not flag it, if va_list looks too much like void*).

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  parent reply	other threads:[~2017-02-28 19:19 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-27 11:20 [Qemu-devel] [PATCH 00/24] block: Command line option -blockdev Markus Armbruster
2017-02-27 11:20 ` [Qemu-devel] [PATCH 01/24] test-qemu-opts: Cover qemu_opts_parse() of "no" Markus Armbruster
2017-02-28 15:34   ` Kevin Wolf
2017-02-27 11:20 ` [Qemu-devel] [PATCH 02/24] tests: Fix gcov-files-test-qemu-opts-y, gcov-files-test-logging-y Markus Armbruster
2017-02-28 15:34   ` Kevin Wolf
2017-02-27 11:20 ` [Qemu-devel] [PATCH 03/24] keyval: New keyval_parse() Markus Armbruster
2017-02-28 15:48   ` Kevin Wolf
2017-02-28 16:36     ` Markus Armbruster
2017-02-28 16:57     ` Eric Blake
2017-02-28 18:03       ` Markus Armbruster
2017-02-28 18:51         ` Eric Blake
2017-02-28 19:15           ` Markus Armbruster
2017-02-27 11:20 ` [Qemu-devel] [PATCH 04/24] qapi: qobject input visitor variant for use with keyval_parse() Markus Armbruster
2017-02-28 16:03   ` Kevin Wolf
2017-02-27 11:20 ` [Qemu-devel] [PATCH 05/24] test-keyval: Cover use with qobject input visitor Markus Armbruster
2017-02-28 16:21   ` Kevin Wolf
2017-02-28 18:04     ` Markus Armbruster
2017-02-27 11:20 ` [Qemu-devel] [PATCH 06/24] qapi: Factor out common part of qobject input visitor creation Markus Armbruster
2017-02-28 16:24   ` Kevin Wolf
2017-02-27 11:20 ` [Qemu-devel] [PATCH 07/24] qapi: Factor out common qobject_input_get_keyval() Markus Armbruster
2017-02-27 11:20 ` [Qemu-devel] [PATCH 08/24] qobject: Propagate parse errors through qobject_from_jsonv() Markus Armbruster
2017-02-28 16:32   ` Kevin Wolf
2017-02-27 11:20 ` [Qemu-devel] [PATCH 09/24] libqtest: Fix qmp() & friends to abort on JSON parse errors Markus Armbruster
2017-02-28 16:51   ` Kevin Wolf
2017-02-28 18:05     ` Markus Armbruster
2017-02-27 11:20 ` [Qemu-devel] [PATCH 10/24] qjson: Abort earlier on qobject_from_jsonf() misuse Markus Armbruster
2017-02-28 16:51   ` Kevin Wolf
2017-02-27 11:20 ` [Qemu-devel] [PATCH 11/24] test-qobject-input-visitor: Abort earlier on bad test input Markus Armbruster
2017-02-28 16:52   ` Kevin Wolf
2017-02-27 11:20 ` [Qemu-devel] [PATCH 12/24] qobject: Propagate parse errors through qobject_from_json() Markus Armbruster
2017-02-28 16:55   ` Kevin Wolf
2017-02-28 19:19   ` Eric Blake [this message]
2017-02-28 19:48     ` Markus Armbruster
2017-02-27 11:20 ` [Qemu-devel] [PATCH 13/24] block: More detailed syntax error reporting for JSON filenames Markus Armbruster
2017-02-28 16:58   ` Kevin Wolf
2017-02-27 11:20 ` [Qemu-devel] [PATCH 14/24] check-qjson: Test errors from qobject_from_json() Markus Armbruster
2017-02-28 17:06   ` Kevin Wolf
2017-02-28 19:25   ` Eric Blake
2017-02-28 19:52     ` Markus Armbruster
2017-02-27 11:20 ` [Qemu-devel] [PATCH 15/24] test-visitor-serialization: Pass &error_abort to qobject_from_json() Markus Armbruster
2017-02-28 17:09   ` Kevin Wolf
2017-02-27 11:20 ` [Qemu-devel] [PATCH 16/24] monitor: Assert qmp_schema_json[] is sane Markus Armbruster
2017-02-28 17:11   ` Kevin Wolf
2017-02-27 11:20 ` [Qemu-devel] [PATCH 17/24] qapi: New qobject_input_visitor_new_str() for convenience Markus Armbruster
2017-02-28 17:18   ` Kevin Wolf
2017-02-28 18:48     ` Markus Armbruster
2017-02-28 19:29       ` Kevin Wolf
2017-02-28 17:33   ` Kevin Wolf
2017-02-28 18:45     ` Markus Armbruster
2017-02-27 11:20 ` [Qemu-devel] [PATCH 18/24] block: Initial implementation of -blockdev Markus Armbruster
2017-02-28 19:38   ` Eric Blake
2017-02-28 19:57   ` Kevin Wolf
2017-02-28 20:59     ` Markus Armbruster
2017-02-27 11:20 ` [Qemu-devel] [PATCH 19/24] qapi: Improve how keyval input visitor reports unexpected dicts Markus Armbruster
2017-02-28 17:51   ` Kevin Wolf
2017-02-28 18:52     ` Markus Armbruster
2017-02-27 11:20 ` [Qemu-devel] [PATCH 20/24] docs/qapi-code-gen.txt: Clarify naming rules Markus Armbruster
2017-02-28 17:54   ` Kevin Wolf
2017-02-27 11:20 ` [Qemu-devel] [PATCH 21/24] test-qapi-util: New, covering qapi/qapi-util.c Markus Armbruster
2017-02-28 17:57   ` Kevin Wolf
2017-02-27 11:20 ` [Qemu-devel] [PATCH 22/24] qapi: New parse_qapi_name() Markus Armbruster
2017-02-28 18:02   ` Kevin Wolf
2017-02-28 18:54     ` Markus Armbruster
2017-02-28 19:48   ` Eric Blake
2017-02-27 11:20 ` [Qemu-devel] [PATCH 23/24] keyval: Restrict key components to valid QAPI names Markus Armbruster
2017-02-28 18:06   ` Kevin Wolf
2017-02-27 11:20 ` [Qemu-devel] [PATCH 24/24] keyval: Support lists Markus Armbruster
2017-02-28 19:25   ` Kevin Wolf
2017-02-28 19:58     ` Markus Armbruster
2017-02-28 20:06     ` Eric Blake
2017-02-28 21:04       ` Markus Armbruster
2017-02-28 16:25 ` [Qemu-devel] [PATCH 00/24] block: Command line option -blockdev Eric Blake

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=f2beae5b-482d-7151-cb7a-1f103e031f3b@redhat.com \
    --to=eblake@redhat.com \
    --cc="mdroth@linux.vnet.ibm.commdroth"@linux.vnet.ibm.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pkrempa@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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 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.