From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLxK4-0000zp-If for qemu-devel@nongnu.org; Wed, 20 Jan 2016 13:17:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLxK1-000881-BH for qemu-devel@nongnu.org; Wed, 20 Jan 2016 13:17:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51593) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLxK1-00087Q-31 for qemu-devel@nongnu.org; Wed, 20 Jan 2016 13:17:33 -0500 References: <1453219845-30939-1-git-send-email-eblake@redhat.com> <1453219845-30939-12-git-send-email-eblake@redhat.com> <87y4bknoi3.fsf@blackfin.pond.sub.org> From: Eric Blake Message-ID: <569FCF3B.1030804@redhat.com> Date: Wed, 20 Jan 2016 11:17:31 -0700 MIME-Version: 1.0 In-Reply-To: <87y4bknoi3.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ajpEKM5GVn0SxvgAtuSjD5KulBJCHGd45" Subject: Re: [Qemu-devel] [PATCH v9 11/37] qapi: Consolidate visitor small integer callbacks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: marcandre.lureau@redhat.com, qemu-devel@nongnu.org, Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ajpEKM5GVn0SxvgAtuSjD5KulBJCHGd45 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/20/2016 10:34 AM, Markus Armbruster wrote: > Eric Blake writes: >=20 >> Commit 4e27e819 introduced optional visitor callbacks for all >> sorts of int types, but no visitor has supplied any of the >> callbacks for sizes less than 64 bits. In other words, the >> generic implementation based on using type_[u]int64() followed >> by bounds-checking works just fine. In the interest of >> simplicity, it's easier to make the visitor callback interface >> not have to worry about the other sizes. >> >> Adding some helper functions minimizes the boilerplate required >> to correct FIXMEs added earlier with regards to questionable >> reuse of errp, particularly now that we can guarantee from a >> single file audit that value is unchanged if an error is set. >> >> Signed-off-by: Eric Blake >> Reviewed-by: Marc-Andr=C3=A9 Lureau >> >> --- >> v9: hoist some of visitor-impl.h changes into 9/35 and 10/35 >> v8: no change >> v7: further factor out helper functions that eliminate the >> questionable errp reuse >> v6: split off from v5 23/46 >> original version also appeared in v6-v9 of subset D >> --- >> include/qapi/visitor-impl.h | 8 +-- >> qapi/qapi-visit-core.c | 158 +++++++++++++++++------------------= --------- >> 2 files changed, 60 insertions(+), 106 deletions(-) >=20 > Nice diffstat. >=20 >> >> diff --git a/include/qapi/visitor-impl.h b/include/qapi/visitor-impl.h= >> index 45c1d3e..e6399d1 100644 >> --- a/include/qapi/visitor-impl.h >> +++ b/include/qapi/visitor-impl.h >> @@ -1,7 +1,7 @@ >> /* >> * Core Definitions for QAPI Visitor implementations >> * >> - * Copyright (C) 2012 Red Hat, Inc. >> + * Copyright (C) 2012, 2015-2016 Red Hat, Inc. >=20 > git-log has authors @redhat.com in 2013 and 2014 as well. I didn't bother to check whether those edits were complex enough to warrant claiming copyright additions; but I'm also amenable to shortening to '2012-2016' on a respin regardless of the sizes of those edits. As it is, I was not very careful about adding 2016 in the v9 spin, so I may be inconsistent on which years are claimed where, in comparison to where I felt I was adding new copyrightable content rather than just minor fixing of existing content. [While it's nice that we DON'T have to assign copyright to a central organization to contribute to qemu, sometimes it is much nicer working on FSF code where a single copyright holder makes discussions like this moot.] >> + } else if (value > max) { >> + error_setg(errp, QERR_INVALID_PARAMETER_VALUE, >> + name ? name : "null", type); >=20 > We should clean up this name ? name : "null" nonsense some day. It all stems from whether the visitor is locally visiting { 'name':value } vs. [ value ]; in an array visit, there is no direct name. Maybe we could go a step higher; if we have: { 'name': [ value ] } then we could require callers to parse value by passing in "[name]" or "name[0]" rather than NULL. Then audit the code to always pass in a sensible name at the top level of a parse. It would even extend to 2-D arrays, via "[[name]]" or "name[0][0]". But not in this series. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --ajpEKM5GVn0SxvgAtuSjD5KulBJCHGd45 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWn887AAoJEKeha0olJ0Nql70IAI/4OydCQMy/4WhliFpDzE5X QkW9jyBnfut8hXBSn8FHF3q2t+QRNEJvBd9B60DIZWNYSmiuZkrqJlbXfaU1JUz3 bvRb6PscAocNazXSU/0KIpvj8VEjm+ayJWVPd5R7jxMsqAGEZodcuJAGiA202PYa 4PPD4HnuKB0dvNrQFk3K0Fw/wf01JXl5+BDse1cd0e5MRbCHSXnkJqsJzTf+ss9j OJGCTqyBYQBuobU1ttilgdeE1V86FSiyMxi8ATluD/dZea0YRDnCdRvY4QemSMhb kMMEHLlYtVW8xAifrrBfSQ4zlKjJhyXzFlzprBWmaP6zA0s2kpve1Z/sF2i70lY= =U3kj -----END PGP SIGNATURE----- --ajpEKM5GVn0SxvgAtuSjD5KulBJCHGd45--