Received: from eggs.gnu.org ([2001:4830:134:3::10]:60114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buQZ6-00019s-VG for qemu-devel@nongnu.org; Wed, 12 Oct 2016 16:55:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buQZ2-0003WW-RW for qemu-devel@nongnu.org; Wed, 12 Oct 2016 16:55:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48546) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buQZ2-0003WS-I3 for qemu-devel@nongnu.org; Wed, 12 Oct 2016 16:55:48 -0400 References: <57FE5B29.4040808@virtuozzo.com> From: Eric Blake Message-ID: <14e53dd6-3ce9-70a2-21f8-6110a1bc970d@redhat.com> Date: Wed, 12 Oct 2016 15:55:45 -0500 MIME-Version: 1.0 In-Reply-To: <57FE5B29.4040808@virtuozzo.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="h4DXwBLIdh06KvwpPkCOoCkkAXnBj8XTC" Subject: Re: [Qemu-devel] error reporting in functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladimir Sementsov-Ogievskiy , qemu-devel , Markus Armbruster This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --h4DXwBLIdh06KvwpPkCOoCkkAXnBj8XTC From: Eric Blake To: Vladimir Sementsov-Ogievskiy , qemu-devel , Markus Armbruster Message-ID: <14e53dd6-3ce9-70a2-21f8-6110a1bc970d@redhat.com> Subject: Re: [Qemu-devel] error reporting in functions References: <57FE5B29.4040808@virtuozzo.com> In-Reply-To: <57FE5B29.4040808@virtuozzo.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/12/2016 10:47 AM, Vladimir Sementsov-Ogievskiy wrote: > HI all! >=20 > My questions is: what are general recommendations in Qemu for return > code, if we have Error **errp? > What should I prefer: errp, duplicated by int return code, or void > functions with errp? Markus has already had several threads commenting on this very topic in the past. A lot of code uses void return, but some newer code is using an int return for simplifying the call-sites (and glib prefers the int rather than void return, as well). Markus was playing with a Coccinelle script to see how painful a bulk-conversion of the code base would be, but it is probably stalled behind more pressing work at the moment. >=20 > void + errp seems good, just to not duplicate things. But it has a > disadvantage of necessity of "local_err" and "error_propagate" in calle= r > function, if its behaviour depends on callee function success... >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --h4DXwBLIdh06KvwpPkCOoCkkAXnBj8XTC 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/ iQEcBAEBCAAGBQJX/qNRAAoJEKeha0olJ0NqUYIH/1X0rTzMwRiP038Ydw7e9Ag5 A9HhQO7jvIWvWpWHmnwEhKZMTk7LtV1c9/iTLe0vpMnneN/rpMHhq/EAGKcAyX8h 9pf4mb4kX72QGOD7fKDrWfJUjFZvXahEN4nkYuiWHreAZkrrVVOR0qB4NWpx8T4C Gd0H7jZyzXybl6MNNvtU8KZivRURXQ3vXNQpW6zOgqViVEp0vCS7FfJ0RXagZEJN 0VGR2WATCZIkPuo/AH5Uuu7kXo1SF+OTZLJDeKQPKEg2IGroQ8m6Nx+0kcnr88BF kMEQZoTgectudeHFNn3NNgs4hKwwvlCmGCadCllbx9au0uwMaopcTz2IybgxB0o= =KUqE -----END PGP SIGNATURE----- --h4DXwBLIdh06KvwpPkCOoCkkAXnBj8XTC--