From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DC363A0350; Thu, 25 Jun 2020 16:30:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 20AAF1B6B4; Thu, 25 Jun 2020 16:30:04 +0200 (CEST) Received: from new3-smtp.messagingengine.com (new3-smtp.messagingengine.com [66.111.4.229]) by dpdk.org (Postfix) with ESMTP id 3F46E1B6B4 for ; Thu, 25 Jun 2020 16:30:02 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id CCB3F5805ED; Thu, 25 Jun 2020 10:30:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Thu, 25 Jun 2020 10:30:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm1; bh= 9CvB/lkFs059bssVnv/dxpB2BOWf1ftxe8rwnYBBDng=; b=Co2wGACfto6dHHd3 W2/4N9jfeP8GBXngXVH7cASSK28ffqV0qEDFymbN9YINltCBVclItPxAZ4fijOCk 7BJWbhjGjTu7Sla8AineYHDBs0EpgzdSyqg1rdHo1bCArxibNKcSkp2CkGiBpQgB AK8RwDecO3HhJVXXZKAgW+lQ9PpLkaKqDWUZep2cVSIfLT+nQlvxymX3fWZXmEzO eQXnKkK70+SNbonfln+EGGiAJwgm39uQq769LJv14Z1rbUW8IIek+SW4YUKwCWIP 2tSUe7M3KqZPTYrb/YF3fA0jskOVX3WUdxU8g2BXGDem/mff9XuW9oaP9kK3s8hI QfaRcA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=9CvB/lkFs059bssVnv/dxpB2BOWf1ftxe8rwnYBBD ng=; b=P83a5G7FFKPKR9OExRYSqntZeSHXeXbV1DzYjVcYw7KmPA34KV6E+dE8y liO8kn1GfAkKMWhC0S6NX6X8/a9N5/xEM/WtClTOLVpT7OXeYenVVb/B3R+DGsXr yKaX27hLi9/mz0iS1jA9q4ERUiFoR8O1HXgcHVAqzEopAqPYs2+dx22ZYl8NcWUB l0saDqLbSC7+m4lOzSPoihkoncl1HFW5Bn3PHcB0JfRRlqlqx4d7fF8SSjMck7B1 1K7gkVryiriom7XJObf867wl8BFpYlHkvOw2orGA9Y/HQhRVU24ScvUmUROpFQsH 9Cv44PsVzdtoorRregTYLuj2qMcfw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudekledgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecugg ftrfgrthhtvghrnhepudeggfdvfeduffdtfeeglefghfeukefgfffhueejtdetuedtjeeu ieeivdffgeehnecukfhppeejjedrudefgedrvddtfedrudekgeenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghl ohhnrdhnvght X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 526A43280065; Thu, 25 Jun 2020 10:29:59 -0400 (EDT) From: Thomas Monjalon To: Tal Shnaiderman Cc: dev@dpdk.org, pallavi.kadam@intel.com, dmitry.kozliuk@gmail.com, david.marchand@redhat.com, grive@u256.net, ranjit.menon@intel.com, navasile@linux.microsoft.com, harini.ramakrishnan@microsoft.com, ocardona@microsoft.com, anatoly.burakov@intel.com, fady@mellanox.com, bruce.richardson@intel.com Date: Thu, 25 Jun 2020 16:29:58 +0200 Message-ID: <9660312.lTyKvTsfxQ@thomas> In-Reply-To: <20200624082847.21344-3-talshn@mellanox.com> References: <20200622075529.24180-2-talshn@mellanox.com> <20200624082847.21344-1-talshn@mellanox.com> <20200624082847.21344-3-talshn@mellanox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v9 02/10] eal: move OS common options functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 24/06/2020 10:28, talshn@mellanox.com: > From: Tal Shnaiderman > > Move common functions between Unix and Windows to eal_common_options.c. > > Those functions are getter functions for rte_application_usage_hook. [...] > +/* Return a pointer to rte_usage_hook_t */ > +rte_usage_hook_t * Why not returning rte_usage_hook_t directly? > +eal_get_application_usage_hook(void) > +{ > + return &rte_application_usage_hook; > +} [...] > +/* Set a per-application usage message */ > +rte_usage_hook_t > +rte_set_application_usage_hook(rte_usage_hook_t usage_func) > +{ > + rte_usage_hook_t old_func; A single space is enough to declare the variable. > + > + /* Will be NULL on the first call to denote the last usage routine. */ > + old_func = rte_application_usage_hook; > + rte_application_usage_hook = usage_func; > + > + return old_func; > +} [...] > eal_usage(const char *prgname) > { > + rte_usage_hook_t *hook = eal_get_application_usage_hook(); > + > printf("\nUsage: %s ", prgname); > eal_common_usage(); > /* Allow the application to print its usage message too if hook is set */ > - if ( rte_application_usage_hook ) { > + if (*hook) { Explicit test is better: if (*hook != NULL) It could even be if (hook != NULL && *hook != NULL), which asks the question why returning the pointer of the pointer? > printf("===== Application Usage =====\n\n"); > - rte_application_usage_hook(prgname); > + (*hook)(prgname); > } > }