From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=BAYES_00,DKIM_ADSP_DISCARD, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D7E9C433DB for ; Tue, 23 Feb 2021 07:11:15 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id C86AC64DF5 for ; Tue, 23 Feb 2021 07:11:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C86AC64DF5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=oktetlabs.ru Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B97A64067A; Tue, 23 Feb 2021 08:11:12 +0100 (CET) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id CB3D840041 for ; Tue, 23 Feb 2021 08:11:11 +0100 (CET) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id 3F0CD7F50C; Tue, 23 Feb 2021 10:11:11 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru 3F0CD7F50C DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1614064271; bh=j3P09Zm4J5mNyE2QpwdNWOy8VnaBlk5KvrL2nADI/ZI=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=RiLPVo1TjCz35LIABGvuGTKGWI/P0drnNxIUUkkked9U5paajzBGSdKz8/BQCpoYc zdsPbWqG2Wb8LceyHyHx10WslIocTTqLzhDKr78rX7zpPkE6zGJ3q/FSPHvzD1X/c5 aiVRu7NeRCfWGWVu3r/yEH3hc+MBrI36EJxwpnuA= To: Dmitry Kozlyuk , dev@dpdk.org Cc: Tal Shnaiderman , Jerin Jacob , Sunil Kumar Kori References: <20210221012831.14643-1-dmitry.kozliuk@gmail.com> <20210221142819.6769-1-dmitry.kozliuk@gmail.com> <20210221142819.6769-2-dmitry.kozliuk@gmail.com> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: Date: Tue, 23 Feb 2021 10:11:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210221142819.6769-2-dmitry.kozliuk@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v3 1/7] eal: add wrappers for POSIX string functions 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" On 2/21/21 5:28 PM, Dmitry Kozlyuk wrote: > POSIX strncasecmp(), strdup(), and strtok_r() have different names > on Windows, respectively, strnicmp(), _strdup(), and strtok_s(). > > Add wrappers as inline functions, because they're used from librte_kvargs, > and thus cannot be in librte_eal; besides, implementation is trivial. > > Signed-off-by: Dmitry Kozlyuk [snip] > +/** > + * @internal > + * strdup(3) replacement for systems that don't have it. > + */ > +static inline char * > +rte_strdup(const char *str) > +{ > +#ifdef RTE_EXEC_ENV_WINDOWS > + return _strdup(str); > +#else > + return strdup(str); > +#endif > +} Allocating memory using rte_strdup() I'd use rte_free() to release it. I guess it will fail badly. So, I think that a different, more specific prefix is required for POSIX wrappers.