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

From: Ingo Molnar
Date: Wed Sep 19 2012 - 07:43:02 EST



* Namhyung Kim <namhyung@xxxxxxxxxx> 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;

(The function here seems to be rather large as well, making it a
possible candidate for shrinkage/splitup.)

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/