[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-44b81e929b0c00e703a31a3d634b668bb27eb1c8@git.kernel.org>
Date: Wed, 22 Dec 2010 11:31:13 GMT
From: tip-bot for Franck Bui-Huu <fbuihuu@...il.com>
To: linux-tip-commits@...r.kernel.org
Cc: acme@...hat.com, linux-kernel@...r.kernel.org, hpa@...or.com,
mingo@...hat.com, masami.hiramatsu.pt@...achi.com,
fbuihuu@...il.com, tglx@...utronix.de
Subject: [tip:perf/core] perf probe: Clean up redundant tests in show_line_range()
Commit-ID: 44b81e929b0c00e703a31a3d634b668bb27eb1c8
Gitweb: http://git.kernel.org/tip/44b81e929b0c00e703a31a3d634b668bb27eb1c8
Author: Franck Bui-Huu <fbuihuu@...il.com>
AuthorDate: Mon, 20 Dec 2010 15:18:02 +0100
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Tue, 21 Dec 2010 16:20:12 -0200
perf probe: Clean up redundant tests in show_line_range()
It also removes some superflous parentheses.
Cc: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
LKML-Reference: <1292854685-8230-4-git-send-email-fbuihuu@...il.com>
Signed-off-by: Franck Bui-Huu <fbuihuu@...il.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/probe-event.c | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 327604c..b812f14 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -373,26 +373,30 @@ int show_line_range(struct line_range *lr, const char *module)
return -errno;
}
/* Skip to starting line number */
- while (l < lr->start && ret >= 0)
+ while (l < lr->start) {
ret = show_one_line(fp, l++, true, false);
- if (ret < 0)
- goto end;
+ if (ret < 0)
+ goto end;
+ }
list_for_each_entry(ln, &lr->line_list, list) {
- while (ln->line > l && ret >= 0)
- ret = show_one_line(fp, (l++) - lr->offset,
- false, false);
- if (ret >= 0)
- ret = show_one_line(fp, (l++) - lr->offset,
- false, true);
+ for (; ln->line > l; l++) {
+ ret = show_one_line(fp, l - lr->offset, false, false);
+ if (ret < 0)
+ goto end;
+ }
+ ret = show_one_line(fp, l++ - lr->offset, false, true);
if (ret < 0)
goto end;
}
if (lr->end == INT_MAX)
lr->end = l + NR_ADDITIONAL_LINES;
- while (l <= lr->end && !feof(fp) && ret >= 0)
- ret = show_one_line(fp, (l++) - lr->offset, false, false);
+ while (l <= lr->end && !feof(fp)) {
+ ret = show_one_line(fp, l++ - lr->offset, false, false);
+ if (ret < 0)
+ break;
+ }
end:
fclose(fp);
return ret;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists