Commit 44b81e92 authored by Franck Bui-Huu's avatar Franck Bui-Huu Committed by Arnaldo Carvalho de Melo

perf probe: Clean up redundant tests in show_line_range()

It also removes some superflous parentheses.

Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
LKML-Reference: <1292854685-8230-4-git-send-email-fbuihuu@gmail.com>
Signed-off-by: default avatarFranck Bui-Huu <fbuihuu@gmail.com>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent befe3414
...@@ -373,26 +373,30 @@ int show_line_range(struct line_range *lr, const char *module) ...@@ -373,26 +373,30 @@ int show_line_range(struct line_range *lr, const char *module)
return -errno; return -errno;
} }
/* Skip to starting line number */ /* Skip to starting line number */
while (l < lr->start && ret >= 0) while (l < lr->start) {
ret = show_one_line(fp, l++, true, false); ret = show_one_line(fp, l++, true, false);
if (ret < 0) if (ret < 0)
goto end; goto end;
}
list_for_each_entry(ln, &lr->line_list, list) { list_for_each_entry(ln, &lr->line_list, list) {
while (ln->line > l && ret >= 0) for (; ln->line > l; l++) {
ret = show_one_line(fp, (l++) - lr->offset, ret = show_one_line(fp, l - lr->offset, false, false);
false, false); if (ret < 0)
if (ret >= 0) goto end;
ret = show_one_line(fp, (l++) - lr->offset, }
false, true); ret = show_one_line(fp, l++ - lr->offset, false, true);
if (ret < 0) if (ret < 0)
goto end; goto end;
} }
if (lr->end == INT_MAX) if (lr->end == INT_MAX)
lr->end = l + NR_ADDITIONAL_LINES; lr->end = l + NR_ADDITIONAL_LINES;
while (l <= lr->end && !feof(fp) && ret >= 0) while (l <= lr->end && !feof(fp)) {
ret = show_one_line(fp, (l++) - lr->offset, false, false); ret = show_one_line(fp, l++ - lr->offset, false, false);
if (ret < 0)
break;
}
end: end:
fclose(fp); fclose(fp);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment