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 BC2C4A0547; Thu, 25 Aug 2022 17:37:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1689C4281C; Thu, 25 Aug 2022 17:37:31 +0200 (CEST) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) by mails.dpdk.org (Postfix) with ESMTP id D5D05415D7 for ; Thu, 25 Aug 2022 17:37:27 +0200 (CEST) Received: by mail-lf1-f42.google.com with SMTP id s1so25932444lfp.6 for ; Thu, 25 Aug 2022 08:37:27 -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=PuiVzYchAX4837C9Bv4TNyIktcjKspOX8T5ULy5qSiRQNEf0Zut4u0wAd66uTi4Tbv J8BSmBjdW7O5hbOt32OowVPtdCPOx8dub6ndJyBVppl5Rv+b2GSMQAsg+Px0L7ExAEdO sZDo2hcXva/NMTgRW32QVtgGmXA+V9HMQFv6JpW7A5UFPExON3wToGf/vE8cJaaIkms4 1gQZdPDDwlntwEZKWJuhdCCsvKYwSNa0znCNNzcHXguO1eq9fMhxdvz1eGonCf4BYq61 dF7ulRMqoGaxIjGdAxGGUD1sSux64UYwz7Rqz/pHK1QaksgR0ZyU7OTCuG7nbHOp/d6F DmJg== 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=rBWDZf9sn9lBchIAzi4o9HsWIc9BlF4l+6FbfAkPiDdlPCIgPhwZs5gT69g3Kz5jIO 5b0+4UL25qczX8eyHv9XAokKePX8egQSqaFUFE7/oRDIpTspWlJH2QXtOUKJR3xp/y9x a73nfmCEyyi3LVZZBrPAkmoP6KYSbvRkh9rmQFiWsicK//wyLq2ZHPFSjDv0XUSsMiig NW8iWsW7XGLT1G5GlKPu+8tGUSqJWnP1GLLv8pHBZf5iUAn7ggRBouHlhzOO5Bvp6dWN UtYmIWMbFj1yrth4OGoB/hT54TeSZRVWphpQ2Tes+zvurcm5Z9yoNn32g8dK0qfHX30M NsoA== X-Gm-Message-State: ACgBeo0jEdlSqt5wFuqFZEo6xBWeun/LJbC7fGka/5AikK3p4Tz2fG+o Ew4/tm2Z6aScrb8GNAmGiKk1zMW619g= X-Google-Smtp-Source: AA6agR5bLmHGRO02Bq5MgC1rZtkmliCyxSpGhloH3ES7OaLUQv/9hgE2/mRiufrlz4y4d3mrMFNxSw== X-Received: by 2002:ac2:4d45:0:b0:492:d8a2:de61 with SMTP id 5-20020ac24d45000000b00492d8a2de61mr1428185lfp.313.1661441847233; Thu, 25 Aug 2022 08:37:27 -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 r2-20020ac25c02000000b0048a9e899693sm562909lfp.16.2022.08.25.08.37.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Aug 2022 08:37:26 -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 v2 3/4] eal: uninline rte_str_to_size Date: Thu, 25 Aug 2022 18:37:08 +0300 Message-Id: <20220825153709.33181-4-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220825153709.33181-1-dmitry.kozliuk@gmail.com> References: <20220821205009.1317044-1-dmitry.kozliuk@gmail.com> <20220825153709.33181-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