From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 53D2D8E56 for ; Fri, 16 Oct 2015 15:07:49 +0200 (CEST) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 8F5AB91DBD; Fri, 16 Oct 2015 13:07:48 +0000 (UTC) Received: from dhcp195.koti.laiskiainen.org (vpn1-6-41.ams2.redhat.com [10.36.6.41]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9GD7kd1011038; Fri, 16 Oct 2015 09:07:47 -0400 To: Bruce Richardson References: <20151016125727.GB9980@bricha3-MOBL3> From: Panu Matilainen Message-ID: <5620F6A2.1020408@redhat.com> Date: Fri, 16 Oct 2015 16:07:46 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151016125727.GB9980@bricha3-MOBL3> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH 1/5] eal: refactor plugin list append from eal_parse_args() to a helper function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Oct 2015 13:07:49 -0000 On 10/16/2015 03:57 PM, Bruce Richardson wrote: > On Fri, Oct 16, 2015 at 02:58:13PM +0300, Panu Matilainen wrote: >> Signed-off-by: Panu Matilainen >> --- >> lib/librte_eal/linuxapp/eal/eal.c | 28 +++++++++++++++++++--------- >> 1 file changed, 19 insertions(+), 9 deletions(-) >> >> diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c >> index 33e1067..cc66d9f 100644 >> --- a/lib/librte_eal/linuxapp/eal/eal.c >> +++ b/lib/librte_eal/linuxapp/eal/eal.c >> @@ -530,6 +530,24 @@ eal_log_level_parse(int argc, char **argv) >> optind = 0; /* reset getopt lib */ >> } >> >> +static int >> +eal_plugin_add(const char *path) >> +{ >> + struct shared_driver *solib; >> + >> + solib = malloc(sizeof(*solib)); >> + if (solib == NULL) { >> + RTE_LOG(ERR, EAL, "malloc(solib) failed\n"); >> + return -1; >> + } >> + memset(solib, 0, sizeof(*solib)); >> + strncpy(solib->name, path, PATH_MAX-1); >> + solib->name[PATH_MAX-1] = 0; > > I always prefer a one-line snprintf to the above two-line code. :-) Me too (or asprintf, depending on situation), but the point of this patch is to move around existing code without changing it. Certainly I can change it to sprintf if that's preferred. - Panu -