[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 12/13] qapi: Replace uncommon use of the error A
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 12/13] qapi: Replace uncommon use of the error API by the common one |
Date: |
Mon, 05 May 2014 15:43:57 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
On 05/02/2014 06:44 AM, Markus Armbruster wrote:
> We commonly use the error API like this:
>
> However, mixing the two techniques is confusing. You can't use the
> "accumulate" technique with functions designed for the "check
> separately" technique. You can use the "check separately" technique
> with functions designed for the "accumulate" technique, but then
> error_set() can't catch you setting an error more than once.
Nice comparison of the two techniques.
>
> Standardize on the "check separately" technique for now, because it's
> overwhelmingly prevalent.
>
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> +++ b/hw/virtio/virtio-balloon.c
> @@ -121,23 +121,27 @@ static void balloon_stats_get_all(Object *obj, struct
> Visitor *v,
> visit_start_struct(v, NULL, NULL, "stats", 0, &err);
> if (err) {
> goto out_end;
> }
> -
> - for (i = 0; i < VIRTIO_BALLOON_S_NR; i++) {
> + for (i = 0; err && i < VIRTIO_BALLOON_S_NR; i++) {
Oops; logic error makes this loop dead code.
s/err/!err/
> @@ -502,7 +503,7 @@ fdecl.write(mcgen('''
> /* THIS FILE IS AUTOMATICALLY GENERATED, DO NOT MODIFY */
>
> /*
> - * schema-defined QAPI visitor function
> + * schema-defined QAPI visitor functions
Unrelated typo fix; could go in separately via -trivial if you were so
inclined, but I don't mind it going in here.
If the logic error is the only fix,
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH 08/13] qapi: Un-inline visit of implicit struct, (continued)
- [Qemu-devel] [PATCH 03/13] qapi: Remove unused Visitor callbacks start_handle(), end_handle(), Markus Armbruster, 2014/05/02
- [Qemu-devel] [PATCH 09/13] hmp: Call visit_end_struct() after visit_start_struct() succeeds, Markus Armbruster, 2014/05/02
- [Qemu-devel] [PATCH 02/13] qapi: Normalize marshalling's visitor initialization and cleanup, Markus Armbruster, 2014/05/02
- [Qemu-devel] [PATCH 05/13] qapi-visit.py: Clean up confusing push_indent() / pop_indent() use, Markus Armbruster, 2014/05/02
- [Qemu-devel] [PATCH 12/13] qapi: Replace uncommon use of the error API by the common one, Markus Armbruster, 2014/05/02
- Re: [Qemu-devel] [PATCH 12/13] qapi: Replace uncommon use of the error API by the common one,
Eric Blake <=
- [Qemu-devel] [PATCH 06/13] qapi: Clean up shadowing of parameters and locals in inner scopes, Markus Armbruster, 2014/05/02
- [Qemu-devel] [PATCH 07/13] qapi-visit.py: Clean up a sloppy use of field prefix, Markus Armbruster, 2014/05/02
- [Qemu-devel] [PATCH 13/13] error: error_is_set() is finally unused; remove, Markus Armbruster, 2014/05/02
- [Qemu-devel] [PATCH 11/13] tests: Don't call visit_end_struct() after visit_start_struct() fails, Markus Armbruster, 2014/05/02
- [Qemu-devel] [PATCH 10/13] hw: Don't call visit_end_struct() after visit_start_struct() fails, Markus Armbruster, 2014/05/02