lkml.org 
[lkml]   [2020]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH RFC v3 02/12] perf jevents: Add support for system events tables
From
Date
On 11/05/2020 12:01, Jiri Olsa wrote:
> On Thu, May 07, 2020 at 07:57:41PM +0800, John Garry wrote:
>
> SNIP
>
>>
>> +static bool is_sys_dir(char *fname)
>> +{
>> + char *pos;
>> +
>> + while (true) {
>> + pos = strchr(fname, '/');
>
> would strrchr be faster?

maybe, I'll check the logic here to see if it can be reduced

also I thought there's something like
> basename function that could be usable in here?

it's tricky, as we support putting JSONs in ./, or ./sys, or ./cpu

But I'll revisit this, as I cannot understand the logic at a glance,
which is not good...

Thanks,
John

>
> jirka
>
>> +
>> + if (!pos) {
>> + if (!strcmp(fname, "sys"))
>> + return true;
>> + return false;
>> + }
>> +
>> + fname = pos + 1;
>> + }
>> +
>> + return false;
>> +}
>
> .
>

\
 
 \ /
  Last update: 2020-05-11 16:53    [W:1.544 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site