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

2014-04-14 Thread Markus Armbruster
Peter Crosthwaite writes: > On Fri, Apr 11, 2014 at 11:41 PM, Markus Armbruster wrote: >> Peter Crosthwaite writes: >> >>> On Thu, Apr 10, 2014 at 1:48 AM, Markus Armbruster >>> wrote: I stumbled over this while trying to purge error_is_set() from the code. Here's how we c

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 wrote: > Peter Crosthwaite writes: > >> On Thu, Apr 10, 2014 at 1:48 AM, Markus Armbruster wrote: >>> I stumbled over this while trying to purge error_is_set() from the code. >>> >>> >>> Here's how we commonly use the Error API: >>> >>> Err

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

2014-04-11 Thread Markus Armbruster
Peter Crosthwaite writes: > On Thu, Apr 10, 2014 at 1:48 AM, Markus Armbruster 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) { >>

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 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) >

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 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: > >> > >> Er

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" 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 Markus Armbruster
Anthony Liguori 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 an error and f

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

2014-04-11 Thread Markus Armbruster
Kevin Wolf 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

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

2014-04-11 Thread Markus Armbruster
"Dr. David Alan Gilbert" 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 ou

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

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)

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 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) >

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, "fo

[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,