public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Adrian Hunter <adrian.hunter@intel.com>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Paul Mackerras <paulus@samba.org>, Jiri Olsa <jolsa@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>, Borislav Petkov <bp@suse.de>
Subject: Re: Re: [perf/core PATCH v4 2/2] perf buildid-cache: Add --purge FILE to remove all caches of FILE
Date: Mon, 23 Feb 2015 15:07:15 +0900	[thread overview]
Message-ID: <54EAC393.3030803@hitachi.com> (raw)
In-Reply-To: <54E78601.40707@linux.vnet.ibm.com>

(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@hitachi.com



  reply	other threads:[~2015-02-23  6:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-20  9:41 [perf/core PATCH v4 0/2] perf-buildid-cache: Enhance --update and add --purge Masami Hiramatsu
2015-02-20  9:41 ` [perf/core PATCH v4 1/2] perf buildid-cache: Add new buildid cache if update target is not cached Masami Hiramatsu
2015-02-20  9:41 ` [perf/core PATCH v4 2/2] perf buildid-cache: Add --purge FILE to remove all caches of FILE Masami Hiramatsu
2015-02-20 19:07   ` Hemant Kumar
2015-02-23  6:07     ` Masami Hiramatsu [this message]
2015-02-21 13:56   ` Namhyung Kim
2015-02-23  6:06     ` Masami Hiramatsu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54EAC393.3030803@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=bp@suse.de \
    --cc=hemant@linux.vnet.ibm.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox