(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...@hitachi.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/