Re: [PATCH] tools lib traceevent: Handle alloc_arg failure

Namhyung Kim
2012-09-19T12:26:59Z

Hi Ingo,

2012-09-19 (수), 13:42 +0200, Ingo Molnar:
> * Namhyung Kim <namhyung@kernel.org> wrote:
>
> > + if (!left) {
> > + do_warning("%s(%d): not enough memory!", __func__, __LINE__);
> > + goto out_free;
>
> > + if (!right) {
> > + do_warning("%s(%d): not enough memory!", __func__, __LINE__);
> > + goto out_free;
> > + }
>
> > + if (!left) {
> > + do_warning("%s(%d): not enough memory!", __func__, __LINE__);
> > + goto out_free;
> > + }
>
> > + if (!left) {
> > + do_warning("%s(%d): not enough memory!", __func__, __LINE__);
> > + goto out_free;
> > + }
>
> > + if (!right) {
> > + do_warning("%s(%d): not enough memory!", __func__, __LINE__);
> > + goto out_free;
> > + }
>
> > + if (!left) {
> > + do_warning("%s(%d): not enough memory!", __func__, __LINE__);
> > + goto out_free;
> > + }
>
> These repetitive patterns are seriously uglifying the code and
> are crying out loud for a out_war_free label:
>
> if (!left)
> goto out_warn_free;

Yeah, I agree. But I wanted to add a bit more helpful (to developers)
info - function name and line number - rather than just "not enough
memory" message. Maybe we could change do_warning to emit such info
automatically.

Thanks,
Namhyung