[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <54EAC393.3030803@hitachi.com>
Date: Mon, 23 Feb 2015 15:07:15 +0900
From: Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>
To: Hemant Kumar <hemant@...ux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Adrian Hunter <adrian.hunter@...el.com>,
linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
Paul Mackerras <paulus@...ba.org>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Borislav Petkov <bp@...e.de>
Subject: Re: Re: [perf/core PATCH v4 2/2] perf buildid-cache: Add --purge
FILE to remove all caches of FILE
(2015/02/21 4:07), Hemant Kumar wrote:
> Hi Masami,
>
> Just a small suggestion below.
>
> On 02/20/2015 03:11 PM, Masami Hiramatsu wrote:
>> [SNIP]
>> +
>> +struct strlist *build_id_cache__list_build_ids(const char *pathname)
>> +{
>> + struct strlist *list;
>> + char *dirname;
>> + DIR *dir;
>> + struct dirent *d;
>> +
>> + list = strlist__new(true, NULL);
>> + dirname = build_id_cache__dirname_from_path(pathname, false, false);
>> + if (!list || !dirname)
>> + goto error_free;
>> +
>> + /* List up all dirents */
>> + dir = opendir(dirname);
>> + if (!dir)
>> + goto error_free;
>> + while ((d = readdir(dir)) != NULL) {
>> + if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
>> + continue;
>> + strlist__add(list, d->d_name);
>> + }
>> + closedir(dir);
>> +
>> + free(dirname);
>> + return list;
>> +
>> +error_free:
>> + free(dirname);
>> + if (list)
>> + strlist__delete(list);
>
> Maybe we don't need the "if (list)" check here as strlist__delete
> already checks for this.
Ah, right!
Thanks!
--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@...achi.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists