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 38C78A034F; Tue, 23 Feb 2021 08:11:13 +0100 (CET) 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.