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 EA342A0543; Sat, 27 Aug 2022 13:32:59 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E98E942836; Sat, 27 Aug 2022 13:32:45 +0200 (CEST) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by mails.dpdk.org (Postfix) with ESMTP id 1FC1F4281B for ; Sat, 27 Aug 2022 13:32:43 +0200 (CEST) Received: by mail-lf1-f53.google.com with SMTP id d23so5079885lfl.13 for ; Sat, 27 Aug 2022 04:32:43 -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=ma7/nNx664PlmCM0nG9bqsfto0Vm5jcdpMari3DGR0CnVnuKHCOTgmuxTHnX4Dlc8G VfxWKucPXWFQp9/aRn+JWCIJmLomRpx3p19yZrDHKmfQPbsqccMQV8MKbs9sZuzlrwLH ZzyRZdAXJnbAuX69ntCrsq45InYSb3PV+7H4tJdpaZBF+Tn18w0jDVYNXd0XPasY0uPL urtxovazaIbTchlLUG6NRnRm1pDcI9DYLIET/5++eZ6lkV22tTSnBZlXPuX1KQI1gkjC Kk7JEtWXMRxrVpNDdJFguCOkRrgaQk/ioWx6kUYMkdzSYzkMOVu8nh8xAcq4vdffKG5e Ojmw== 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=oTzGpIwDmgX+V5LxWqO1XTt9myy0ipq5cRCr5BSXsz5SI9UjW0Q61ZyCyXN6GpbQw9 hgW3aVLAxFeukTVpwECRp+07G5IkntOqnCfLs31cGgyoeeqJxKhpOGvAurgeeaBQtafT lHDNbjLU6NO5VbtwnZT2KSa5+VC8Y4XRPzzwDjMEQHjnR3DuM3DJdqw5ncN0rs6Eh7Ns MxB5HGLHvXZ0xU5QjvoqijHmdTRE8letg6IIDRkkDw6wqM1YdMSHc8ffxiSVExGl0DNW fohjdneh2Agx/fkpPqOUppzkgJSFOvpiC448RhLPTthpR4SGYQ6TnGZ7f2KQ2gn5oGwM Xg6Q== X-Gm-Message-State: ACgBeo27EiID0IWifDuRy74CJLBaeUY8FoJlUzug/9lj3XzEFfK8P25Q /mBbMqvqh6orsq1EArpvVuVMtqlkdtA= X-Google-Smtp-Source: AA6agR4p6zR/ookqBGfaRO7yGPicuUGP4gmddtBCdL9rCNIi9s+tLF55b6ITKSz2ldgzD3olpStH8w== X-Received: by 2002:a05:6512:b89:b0:492:e4bf:adcf with SMTP id b9-20020a0565120b8900b00492e4bfadcfmr3572152lfv.203.1661599962404; Sat, 27 Aug 2022 04:32:42 -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 o18-20020a05651205d200b0048bd7136ef3sm640663lfo.221.2022.08.27.04.32.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Aug 2022 04:32:41 -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 v4 3/4] eal: uninline rte_str_to_size Date: Sat, 27 Aug 2022 14:32:21 +0300 Message-Id: <20220827113222.3951505-4-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220827113222.3951505-1-dmitry.kozliuk@gmail.com> References: <20220825223355.410540-1-dmitry.kozliuk@gmail.com> <20220827113222.3951505-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