aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorFranck Bui-Huu <fbuihuu@gmail.com>2010-12-20 09:18:02 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-12-21 13:20:12 -0500
commit44b81e929b0c00e703a31a3d634b668bb27eb1c8 (patch)
treead5cc15fcbe7389ea37a9af630f8cec218e1fae7 /tools
parentbefe341468f4e61ecaf337a0237f2aab76817437 (diff)
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: Franck Bui-Huu <fbuihuu@gmail.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/probe-event.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 327604c1253f..b812f1412c3a 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)
373 return -errno; 373 return -errno;
374 } 374 }
375 /* Skip to starting line number */ 375 /* Skip to starting line number */
376 while (l < lr->start && ret >= 0) 376 while (l < lr->start) {
377 ret = show_one_line(fp, l++, true, false); 377 ret = show_one_line(fp, l++, true, false);
378 if (ret < 0) 378 if (ret < 0)
379 goto end; 379 goto end;
380 }
380 381
381 list_for_each_entry(ln, &lr->line_list, list) { 382 list_for_each_entry(ln, &lr->line_list, list) {
382 while (ln->line > l && ret >= 0) 383 for (; ln->line > l; l++) {
383 ret = show_one_line(fp, (l++) - lr->offset, 384 ret = show_one_line(fp, l - lr->offset, false, false);
384 false, false); 385 if (ret < 0)
385 if (ret >= 0) 386 goto end;
386 ret = show_one_line(fp, (l++) - lr->offset, 387 }
387 false, true); 388 ret = show_one_line(fp, l++ - lr->offset, false, true);
388 if (ret < 0) 389 if (ret < 0)
389 goto end; 390 goto end;
390 } 391 }
391 392
392 if (lr->end == INT_MAX) 393 if (lr->end == INT_MAX)
393 lr->end = l + NR_ADDITIONAL_LINES; 394 lr->end = l + NR_ADDITIONAL_LINES;
394 while (l <= lr->end && !feof(fp) && ret >= 0) 395 while (l <= lr->end && !feof(fp)) {
395 ret = show_one_line(fp, (l++) - lr->offset, false, false); 396 ret = show_one_line(fp, l++ - lr->offset, false, false);
397 if (ret < 0)
398 break;
399 }
396end: 400end:
397 fclose(fp); 401 fclose(fp);
398 return ret; 402 return ret;