From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id ECF8FA0C44; Mon, 12 Apr 2021 08:52:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7ACA814155C; Mon, 12 Apr 2021 08:52:56 +0200 (CEST) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mails.dpdk.org (Postfix) with ESMTP id 6D712141559 for ; Mon, 12 Apr 2021 08:52:55 +0200 (CEST) Received: by mail-wm1-f48.google.com with SMTP id y204so4726139wmg.2 for ; Sun, 11 Apr 2021 23:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cXjD+Ya6PMo3+Fkx+8cldynkXnpoa1I9P3QY8O/R0XA=; b=abSbecjRnSuvrHEviPAv7kFaNxMWV5fYKtj3XhXfqItldq18UHD190oL+rkfNpwDsm Hle8jaQbhJa4y0pd2RvF5LzTjtsiHbOufccSFeNWqpjZLfKEdEzTwXZ8Y86Iuel1r7Pv Q6dXua/mqJ61+jLkdOHchUzJsgHfMqUfYHZTXP4+7VXRgK5Vr5HZcK/j+L0j+IL030up lbFe0awZC2coBY/u+hoSv819Cr+qNHzRpMzLQCaX8KaUreJGpCkFQRI/oQqHF2bVtKG/ 9oZXCp0yRzv2LNIBsusGHpTolSyUrvfs016reIYGap3XRqonXZo40sMPxSD1b2135fT+ LgPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=cXjD+Ya6PMo3+Fkx+8cldynkXnpoa1I9P3QY8O/R0XA=; b=PPTXxitaqZfBLV9SKv+oitnfFzm3vsFBaV8Ww6epln4oQjFESiObuBqAHvInA5tzbk h7KfypSQTp0kGFs5iuTmbzO/vpk5u7WMgU98qwajZdjp1J6Nw8UI1zU3JzAIhFsZqLh1 jLyvhXg/OYlydW7+NSiH384pQNAyti6bdANjxHnW0vXp/nVjOwmIpqbPPxf10lqM1cI4 FrEa+0JypPrcyz3QPTCHdOkQQImZ6eRKVgvtAGJxFbY9vy89jPSlhkw7Jv1cat2Bu3jc Y1bROStQVn9V1YqGcqv9xihI4Knm/HFyyVPKTPD0YAnMZf4TlXxTskq+WnuMeyfvHpQl tRCg== X-Gm-Message-State: AOAM5334S9yjCPj/wl6b9OzUqACIXwu8TTCgrE68EVSgj2cPrCeJbBth TX3quY0MoBLSIgn2J1Ww0GTKaQ== X-Google-Smtp-Source: ABdhPJyvep8Y/2zyTvQ3t12RznRP+Hp3/MJkPFYbdYCo11dBYTgtiSRNr08g3zFnbH0xnpY2YGeNEg== X-Received: by 2002:a1c:e006:: with SMTP id x6mr3363225wmg.40.1618210375122; Sun, 11 Apr 2021 23:52:55 -0700 (PDT) Received: from 6wind.com ([2a01:e0a:5ac:6460:c065:401d:87eb:9b25]) by smtp.gmail.com with ESMTPSA id w4sm12336313wrp.58.2021.04.11.23.52.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Apr 2021 23:52:54 -0700 (PDT) Date: Mon, 12 Apr 2021 08:52:53 +0200 From: Olivier Matz To: Xueming Li Cc: Thomas Monjalon , Gaetan Rivet , dev@dpdk.org, Asaf Penso , Ray Kinsella , Neil Horman Message-ID: <20210412065253.GD1650@platinum> References: <1608304614-13908-2-git-send-email-xuemingl@nvidia.com> <1618064637-16413-4-git-send-email-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1618064637-16413-4-git-send-email-xuemingl@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH v4 3/5] kvargs: add get by key function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Hi Xueming, On Sat, Apr 10, 2021 at 02:23:55PM +0000, Xueming Li wrote: > Adds a new function to get value of a specific key from kvargs list. > > Signed-off-by: Xueming Li > Reviewed-by: Gaetan Rivet > --- > lib/librte_kvargs/rte_kvargs.c | 20 ++++++++++++++++++++ > lib/librte_kvargs/rte_kvargs.h | 21 +++++++++++++++++++++ > lib/librte_kvargs/version.map | 3 +++ > 3 files changed, 44 insertions(+) > > diff --git a/lib/librte_kvargs/rte_kvargs.c b/lib/librte_kvargs/rte_kvargs.c > index ffae8914cf..40e7670ab3 100644 > --- a/lib/librte_kvargs/rte_kvargs.c > +++ b/lib/librte_kvargs/rte_kvargs.c > @@ -203,6 +203,26 @@ rte_kvargs_free(struct rte_kvargs *kvlist) > free(kvlist); > } > > +/* Lookup a value in an rte_kvargs list by its key. */ > +const char * > +rte_kvargs_get(const struct rte_kvargs *kvlist, const char *key) > +{ > + unsigned int i; > + > + if (!kvlist) > + return NULL; > + for (i = 0; i < kvlist->count; ++i) { > + /* Allows key to be NULL. */ > + if (!key && !kvlist->pairs[i].key) > + return kvlist->pairs[i].value; Is it possible that kvlist->pairs[i].key == NULL? In which case? Thanks, Olivier