lkml.org 
[lkml]   [2010]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 3/6] perf-probe: clean up redundant tests in show_line_range()
    (2010/12/20 23:18), Franck Bui-Huu wrote:
    > From: Franck Bui-Huu <fbuihuu@gmail.com>
    >
    > It also removes some superflous parentheses.

    Oh, don't remove your superfluous comments too! ;-)


    >
    > Signed-off-by: Franck Bui-Huu <fbuihuu@gmail.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 5cc8f6b..3c92b92 100644
    > --- a/tools/perf/util/probe-event.c
    > +++ b/tools/perf/util/probe-event.c
    > @@ -383,26 +383,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;


    --
    Masami HIRAMATSU
    2nd Dept. Linux Technology Center
    Hitachi, Ltd., Systems Development Laboratory
    E-mail: masami.hiramatsu.pt@hitachi.com


    \
     
     \ /
      Last update: 2010-12-21 10:51    [W:0.025 / U:124.564 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site