From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1162736AbcE3WV1 (ORCPT ); Mon, 30 May 2016 18:21:27 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:36245 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162060AbcE3WVW (ORCPT ); Mon, 30 May 2016 18:21:22 -0400 Subject: Re: [PATCH v3 4/7] perf config: Reimplement perf_config() using perf_config_set__iter() To: Arnaldo Carvalho de Melo References: <1464626651-1523-1-git-send-email-treeze.taeung@gmail.com> <1464626651-1523-5-git-send-email-treeze.taeung@gmail.com> <20160530193254.GC2563@kernel.org> Cc: linux-kernel@vger.kernel.org, Jiri Olsa , Namhyung Kim , Ingo Molnar , Peter Zijlstra , Alexander Shishkin , Masami Hiramatsu , Jiri Olsa , Wang Nan , Ingo Molnar From: Taeung Song Message-ID: <574CBCD8.2000209@gmail.com> Date: Tue, 31 May 2016 07:21:12 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <20160530193254.GC2563@kernel.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/31/2016 04:32 AM, Arnaldo Carvalho de Melo wrote: > Em Tue, May 31, 2016 at 01:44:08AM +0900, Taeung Song escreveu: >> +static int perf_config_set__iter(struct perf_config_set *set, config_fn_t fn, void *data) >> +{ >> + struct perf_config_section *section; >> + struct perf_config_item *item; >> + struct list_head *sections; >> + char key[BUFSIZ]; >> + >> + if (set == NULL) >> + return -1; > >> + return 0; >> +} >> +int perf_config(config_fn_t fn, void *data) >> +{ >> + if (perf_config_set__check() < 0) >> + return -1; >> + return perf_config_set__iter(config_set, fn, data); >> +} > > "check" looks too vague, this is equivalent, no? > > int perf_config(config_fn_t, void *data) > { > if (config_set == NULL) > config_set = perf_config_set__new(); > > return perf_config_set__iter(config_set, fn, data); > } > I understood it! I thought __check() function is needed for readability. But I'll remove __check() because it would seem that the function isn't needed as you said. Thanks, Taeung