Re: [Qemu-devel] Error propagation in generated visitors and command marshallers

2014-04-14 Thread Markus Armbruster
Peter Crosthwaite peter.crosthwa...@xilinx.com writes: On Fri, Apr 11, 2014 at 11:41 PM, Markus Armbruster arm...@redhat.com wrote: Peter Crosthwaite peter.crosthwa...@xilinx.com writes: On Thu, Apr 10, 2014 at 1:48 AM, Markus Armbruster arm...@redhat.com wrote: I stumbled over this while

Re: [Qemu-devel] Error propagation in generated visitors and command marshallers

2014-04-11 Thread Markus Armbruster
Dr. David Alan Gilbert dgilb...@redhat.com writes: * Markus Armbruster (arm...@redhat.com) wrote: I stumbled over this while trying to purge error_is_set() from the code. Here's how we commonly use the Error API: Error *err = NULL; foo(arg, err) if (err) { goto

Re: [Qemu-devel] Error propagation in generated visitors and command marshallers

2014-04-11 Thread Markus Armbruster
Kevin Wolf kw...@redhat.com writes: Am 09.04.2014 um 17:48 hat Markus Armbruster geschrieben: I stumbled over this while trying to purge error_is_set() from the code. Here's how we commonly use the Error API: Error *err = NULL; foo(arg, err) if (err) { goto out;

Re: [Qemu-devel] Error propagation in generated visitors and command marshallers

2014-04-11 Thread Markus Armbruster
Anthony Liguori anth...@codemonkey.ws writes: The original visiting code was loosely based on ASN1 marshaling code from Samba which used the if error, bail out at the top style of error handling. As use of Error has evolved in QEMU, I agree that the paradigm of bail out as soon as you see

Re: [Qemu-devel] Error propagation in generated visitors and command marshallers

2014-04-11 Thread Dr. David Alan Gilbert
* Markus Armbruster (arm...@redhat.com) wrote: Dr. David Alan Gilbert dgilb...@redhat.com writes: * Markus Armbruster (arm...@redhat.com) wrote: I stumbled over this while trying to purge error_is_set() from the code. Here's how we commonly use the Error API: Error *err = NULL;

Re: [Qemu-devel] Error propagation in generated visitors and command marshallers

2014-04-11 Thread Kevin Wolf
Am 11.04.2014 um 10:28 hat Markus Armbruster geschrieben: Kevin Wolf kw...@redhat.com writes: Am 09.04.2014 um 17:48 hat Markus Armbruster geschrieben: I stumbled over this while trying to purge error_is_set() from the code. Here's how we commonly use the Error API: Error

Re: [Qemu-devel] Error propagation in generated visitors and command marshallers

2014-04-11 Thread Peter Crosthwaite
On Thu, Apr 10, 2014 at 1:48 AM, Markus Armbruster arm...@redhat.com wrote: I stumbled over this while trying to purge error_is_set() from the code. Here's how we commonly use the Error API: Error *err = NULL; foo(arg, err) if (err) { goto out; } bar(arg,

Re: [Qemu-devel] Error propagation in generated visitors and command marshallers

2014-04-11 Thread Markus Armbruster
Peter Crosthwaite peter.crosthwa...@xilinx.com writes: On Thu, Apr 10, 2014 at 1:48 AM, Markus Armbruster arm...@redhat.com wrote: I stumbled over this while trying to purge error_is_set() from the code. Here's how we commonly use the Error API: Error *err = NULL; foo(arg, err)

Re: [Qemu-devel] Error propagation in generated visitors and command marshallers

2014-04-11 Thread Peter Crosthwaite
On Fri, Apr 11, 2014 at 11:41 PM, Markus Armbruster arm...@redhat.com wrote: Peter Crosthwaite peter.crosthwa...@xilinx.com writes: On Thu, Apr 10, 2014 at 1:48 AM, Markus Armbruster arm...@redhat.com wrote: I stumbled over this while trying to purge error_is_set() from the code. Here's how

Re: [Qemu-devel] Error propagation in generated visitors and command marshallers

2014-04-10 Thread Kevin Wolf
Am 09.04.2014 um 17:48 hat Markus Armbruster geschrieben: I stumbled over this while trying to purge error_is_set() from the code. Here's how we commonly use the Error API: Error *err = NULL; foo(arg, err) if (err) { goto out; } bar(arg, err) if

[Qemu-devel] Error propagation in generated visitors and command marshallers

2014-04-09 Thread Markus Armbruster
I stumbled over this while trying to purge error_is_set() from the code. Here's how we commonly use the Error API: Error *err = NULL; foo(arg, err) if (err) { goto out; } bar(arg, err) if (err) { goto out; } This ensures that err is null on entry,

Re: [Qemu-devel] Error propagation in generated visitors and command marshallers

2014-04-09 Thread Eric Blake
On 04/09/2014 09:48 AM, Markus Armbruster wrote: I stumbled over this while trying to purge error_is_set() from the code. But: is it a good idea to have both patterns in the code? Should we perhaps use the common pattern for visiting, too? Like this: visit_type_str(v, foo, foo,

Re: [Qemu-devel] Error propagation in generated visitors and command marshallers

2014-04-09 Thread Anthony Liguori
On Wed, Apr 9, 2014 at 8:48 AM, Markus Armbruster arm...@redhat.com wrote: I stumbled over this while trying to purge error_is_set() from the code. Here's how we commonly use the Error API: Error *err = NULL; foo(arg, err) if (err) { goto out; } bar(arg,

Re: [Qemu-devel] Error propagation in generated visitors and command marshallers

2014-04-09 Thread Dr. David Alan Gilbert
* Markus Armbruster (arm...@redhat.com) wrote: I stumbled over this while trying to purge error_is_set() from the code. Here's how we commonly use the Error API: Error *err = NULL; foo(arg, err) if (err) { goto out; } bar(arg, err) if (err) {