lkml.org 
[lkml]   [2013]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 3/9] perf util: Get rid of write_or_die() from trace-event-info.c
From
Date
On Tue, 2013-03-19 at 10:59 -0400, Steven Rostedt wrote:
> On Tue, 2013-03-19 at 15:49 +0100, Peter Zijlstra wrote:
> > On Tue, 2013-03-19 at 10:35 -0400, Steven Rostedt wrote:
> > > What about:
> > > int err = 0;
> > >
> > > err += tracing_data_header();
> > > err += read_header_files();
> > > [...]
> > >
> > > if (err < 0) {
> > > free(tdata);
> > > tdata = NULL;
> > > }
> > >
> > > Also, is the only clean up needed be freeing tdata?
> >
> > I always use err |= foo() and if (err) but I suppose it doesn't matter
> > the original error codes are lost both ways which doesn't seem to be a
> > problem here.
>
> err |= foo() is fine too. Both are better that err1, err2, err3, ...,
> errN :-)

<whinge>

The += thing has a problem where functions can return both positive and
negative values, you could get an accidental 0 (success) but coupled
with the proposed <0 test you get a much larger accident space :-)

And while totally hideous the err1..errN case preserves the actual
return codes if one would actually need those.

</whinge>

/me crawls back under his rock noaw :-)



\
 
 \ /
  Last update: 2013-03-19 23:41    [W:0.074 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site