perf tools: Ditch rtrim(), use strim() from tools/lib
Cleaning up a bit more tools/perf/util/ by using things we got from the kernel and have in tools/lib/ Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-7hluuoveryoicvkclshzjf1k@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -1048,7 +1048,7 @@ static int cpu_cache_level__read(struct cpu_cache_level *cache, u32 cpu, u16 lev
|
||||
return -1;
|
||||
|
||||
cache->type[len] = 0;
|
||||
cache->type = rtrim(cache->type);
|
||||
cache->type = strim(cache->type);
|
||||
|
||||
scnprintf(file, PATH_MAX, "%s/size", path);
|
||||
if (sysfs__read_str(file, &cache->size, &len)) {
|
||||
@@ -1057,7 +1057,7 @@ static int cpu_cache_level__read(struct cpu_cache_level *cache, u32 cpu, u16 lev
|
||||
}
|
||||
|
||||
cache->size[len] = 0;
|
||||
cache->size = rtrim(cache->size);
|
||||
cache->size = strim(cache->size);
|
||||
|
||||
scnprintf(file, PATH_MAX, "%s/shared_cpu_list", path);
|
||||
if (sysfs__read_str(file, &cache->map, &len)) {
|
||||
@@ -1067,7 +1067,7 @@ static int cpu_cache_level__read(struct cpu_cache_level *cache, u32 cpu, u16 lev
|
||||
}
|
||||
|
||||
cache->map[len] = 0;
|
||||
cache->map = rtrim(cache->map);
|
||||
cache->map = strim(cache->map);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user