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 6C26AA0551; Fri, 26 Aug 2022 00:34:34 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0FBBF42829; Fri, 26 Aug 2022 00:34:19 +0200 (CEST) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) by mails.dpdk.org (Postfix) with ESMTP id C561A40693 for ; Fri, 26 Aug 2022 00:34:14 +0200 (CEST) Received: by mail-lj1-f176.google.com with SMTP id x10so20821088ljq.4 for ; Thu, 25 Aug 2022 15:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=zenFBCYP3ig2zKLvJ8GGjWTGkwpnUUqkE2EdFf4PgSo=; b=RdDmMTH6bWAp/9Es4xlRHyhcLEsnXgJJzYwaCJApYdZi8w9HYyyekx0YUIW9gunoaq syPzcLGIbE3RZGzQakS1be/9RkAE4OHTvjjO0yvq4fz9Z+kBJcQs8NAk4eGtWZyJFS+7 aTcIBDYQZ8D71FKivg9MHDO88lJ39ZrO1FP9JXXHtch4nHX/L0EJwRVAWIGrsCP6ie+R e+y/R11E7Fc/D+9w59dbhZcGrtbq1L2clDrcyYh7vXRosnCJYdQjxhS5YFUaHCc5tAlJ Q2kt68MmeEUtNWJ6I+ky7aBzlTfqutFqwr0Wv0WB5HPkE6/CtXQTbW5CWu0Fc8ussOJt rhWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=zenFBCYP3ig2zKLvJ8GGjWTGkwpnUUqkE2EdFf4PgSo=; b=MLa8LZQgRnKjLIJs+LWi1p7+ka4LCZb1NBSvYqbxZ2kCbx/T4Mqw8JwOLdaSS+yum0 iFv3kEqNkeWBQQao8ZSzHrucq7mg5BInfx8MFO4mK/D91f/kunt3lzCYZVHkFD4IjhiF yiC7C1BmJK1PPLfDVYKRGFUhku9kSv/HhPkEOKDaHuOVrAcw6UMFdFqIA/Gs0dbPdF24 iWR8b16XEKQr58Csp9qrex+xqPcZexibsfHj+1x9OP+gw+fsKmT3pOzXo/Tlnr0hG/MC 3CxMtb8xyEAaERZ4OxbN3t7H5Ksurvt3Wslwus3DIhNNpCiMYzSa8gdLSEj8fFXpeM9l /Y7Q== X-Gm-Message-State: ACgBeo06fUkkAbOjXpqamybT7c+sPrvwgElXasX4yl62Dn9aIK8BMsxG ZxmSrlnh2wN68dB5BAAXgt36Fy7pU+g= X-Google-Smtp-Source: AA6agR4/DaMxsbjW6c47g5bXLZCLDzl18Iozx624xpsgLvqTuRNiDVXpcn8i8SHmjNcDpzsSGC5G1g== X-Received: by 2002:a05:651c:198e:b0:261:d4a5:db55 with SMTP id bx14-20020a05651c198e00b00261d4a5db55mr1822241ljb.231.1661466854063; Thu, 25 Aug 2022 15:34:14 -0700 (PDT) Received: from sovereign.. (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id f16-20020ac25090000000b0048b0975ac7asm68249lfm.151.2022.08.25.15.34.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Aug 2022 15:34:13 -0700 (PDT) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Ray Kinsella , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Bruce Richardson , Chengwen Feng Subject: [PATCH v3 3/4] eal: uninline rte_str_to_size Date: Fri, 26 Aug 2022 01:33:54 +0300 Message-Id: <20220825223355.410540-4-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220825223355.410540-1-dmitry.kozliuk@gmail.com> References: <20220825153709.33181-1-dmitry.kozliuk@gmail.com> <20220825223355.410540-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 There is no reason for rte_str_to_size() to be inline. Move the implementation out of . Export it as a stable ABI because it always has been public. Signed-off-by: Dmitry Kozlyuk Acked-by: Morten Brørup Acked-by: Bruce Richardson Acked-by: Chengwen Feng --- lib/eal/common/eal_common_string_fns.c | 32 ++++++++++++++++++++++++++ lib/eal/include/rte_common.h | 30 ++---------------------- lib/eal/version.map | 1 + 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/lib/eal/common/eal_common_string_fns.c b/lib/eal/common/eal_common_string_fns.c index 0236ae4023..5fc4ee71dc 100644 --- a/lib/eal/common/eal_common_string_fns.c +++ b/lib/eal/common/eal_common_string_fns.c @@ -64,3 +64,35 @@ rte_strscpy(char *dst, const char *src, size_t dsize) rte_errno = E2BIG; return -rte_errno; } + +uint64_t +rte_str_to_size(const char *str) +{ + char *endptr; + unsigned long long size; + + while (isspace((int)*str)) + str++; + if (*str == '-') + return 0; + + errno = 0; + size = strtoull(str, &endptr, 0); + if (errno) + return 0; + + if (*endptr == ' ') + endptr++; /* allow 1 space gap */ + + switch (*endptr) { + case 'G': case 'g': + size *= 1024; /* fall-through */ + case 'M': case 'm': + size *= 1024; /* fall-through */ + case 'K': case 'k': + size *= 1024; /* fall-through */ + default: + break; + } + return size; +} diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index b65555bac6..86c50c55e0 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -873,34 +873,8 @@ rte_log2_u64(uint64_t v) * @return * Number. */ -static inline uint64_t -rte_str_to_size(const char *str) -{ - char *endptr; - unsigned long long size; - - while (isspace((int)*str)) - str++; - if (*str == '-') - return 0; - - errno = 0; - size = strtoull(str, &endptr, 0); - if (errno) - return 0; - - if (*endptr == ' ') - endptr++; /* allow 1 space gap */ - - switch (*endptr){ - case 'G': case 'g': size *= 1024; /* fall-through */ - case 'M': case 'm': size *= 1024; /* fall-through */ - case 'K': case 'k': size *= 1024; /* fall-through */ - default: - break; - } - return size; -} +uint64_t +rte_str_to_size(const char *str); /** * Function to terminate the application immediately, printing an error diff --git a/lib/eal/version.map b/lib/eal/version.map index 1f293e768b..773b0902c0 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -261,6 +261,7 @@ DPDK_23 { rte_socket_id; rte_socket_id_by_idx; rte_srand; + rte_str_to_size; rte_strerror; rte_strscpy; rte_strsplit; -- 2.33.1