Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1570922

Re: [PATCH v2 1/4] perf tools: Create for_each_event macro for tracepoints iteration

From Steven Rostedt <rostedt@goodmis.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/4] perf tools: Create for_each_event macro for tracepoints iteration
Date 2017-01-31 18:40 +0100
Message-ID <t5Kzn-3vy-3@gated-at.bofh.it> (permalink)
References <t5EX0-8E-3@gated-at.bofh.it> <t5EX0-8E-7@gated-at.bofh.it> <t5FJo-DW-13@gated-at.bofh.it> <t5FJo-DW-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 31 Jan 2017 09:23:48 -0300
Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Em Tue, Jan 31, 2017 at 09:21:16AM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Tue, Jan 31, 2017 at 08:38:28PM +0900, Taeung Song escreveu:  
> > > -	while ((dent = readdir(dir))) {
> > > -		if (dent->d_type != DT_DIR ||
> > > -		    strcmp(dent->d_name, ".") == 0 ||
> > > -		    strcmp(dent->d_name, "..") == 0 ||
> > > -		    strcmp(dent->d_name, "ftrace") == 0 ||
> > > +	for_each_event(dir, dent, tps) {
> > > +		if (!strcmp(dent->d_name, "ftrace") ||
> > >  		    !system_in_tp_list(dent->d_name, tps))
> > >  			continue;  
> 
> > the existing style was == 0, you switched it to !, equivalent, but
> > gratuitous, keeping the existing style would make reviewing slightly
> > faster, as the pattern wouldn't have changed.  
>  
> Here it is:
> 
> -       while ((dent = readdir(dir))) {
> -               if (dent->d_type != DT_DIR ||
> -                   strcmp(dent->d_name, ".") == 0 ||
> -                   strcmp(dent->d_name, "..") == 0 ||
> -                   strcmp(dent->d_name, "ftrace") == 0 ||
> +       for_each_event(dir, dent, tps) {
> +               if (strcmp(dent->d_name, "ftrace") == 0 ||
>                     !system_in_tp_list(dent->d_name, tps))
>                         continue;

Thanks, because I always screw up the !strcmp(). Thus I find the "== 0"
to me is easier to process "matches" and "!= 0" is "doesn't match".

-- Steve

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/4] perf tools: Create for_each_event macro for tracepoints iteration Taeung Song <treeze.taeung@gmail.com> - 2017-01-31 12:40 +0100
  Re: [PATCH v2 1/4] perf tools: Create for_each_event macro for  tracepoints iteration Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-01-31 13:30 +0100
    Re: [PATCH v2 1/4] perf tools: Create for_each_event macro for  tracepoints iteration Steven Rostedt <rostedt@goodmis.org> - 2017-01-31 18:40 +0100
  Re: [PATCH v2 1/4] perf tools: Create for_each_event macro for  tracepoints iteration Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-01-31 13:30 +0100
    Re: [PATCH v2 1/4] perf tools: Create for_each_event macro for  tracepoints iteration Taeung Song <treeze.taeung@gmail.com> - 2017-02-01 08:10 +0100
  [tip:perf/core] perf tools: Create for_each_event macro for  tracepoints iteration tip-bot for Taeung Song <tipbot@zytor.com> - 2017-02-01 15:50 +0100

csiph-web