Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752157AbbBWGHX (ORCPT ); Mon, 23 Feb 2015 01:07:23 -0500 Received: from mail9.hitachi.co.jp ([133.145.228.44]:60373 "EHLO mail9.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751861AbbBWGHW (ORCPT ); Mon, 23 Feb 2015 01:07:22 -0500 Message-ID: <54EAC393.3030803@hitachi.com> Date: Mon, 23 Feb 2015 15:07:15 +0900 From: Masami Hiramatsu Organization: Hitachi, Ltd., Japan User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Hemant Kumar Cc: Arnaldo Carvalho de Melo , Peter Zijlstra , Adrian Hunter , linux-kernel@vger.kernel.org, Ingo Molnar , Paul Mackerras , Jiri Olsa , Namhyung Kim , Borislav Petkov Subject: Re: Re: [perf/core PATCH v4 2/2] perf buildid-cache: Add --purge FILE to remove all caches of FILE References: <20150220094145.4942.22046.stgit@localhost.localdomain> <20150220094150.4942.13002.stgit@localhost.localdomain> <54E78601.40707@linux.vnet.ibm.com> In-Reply-To: <54E78601.40707@linux.vnet.ibm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1445 Lines: 59 (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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/