From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id D529AA05D3 for ; Tue, 21 May 2019 04:33:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1EB704CA6; Tue, 21 May 2019 04:33:50 +0200 (CEST) Received: from tama500.ecl.ntt.co.jp (tama500.ecl.ntt.co.jp [129.60.39.148]) by dpdk.org (Postfix) with ESMTP id 8FF444C80 for ; Tue, 21 May 2019 04:33:48 +0200 (CEST) Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id x4L2Xld5009097; Tue, 21 May 2019 11:33:47 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id E87ECEA7A91; Tue, 21 May 2019 11:33:46 +0900 (JST) Received: from localhost.localdomain (lobster.nslab.ecl.ntt.co.jp [129.60.13.95]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id D860EEA7939; Tue, 21 May 2019 11:33:46 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp Date: Tue, 21 May 2019 11:31:19 +0900 Message-Id: <1558405882-8201-4-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558405882-8201-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> References: <1558405882-8201-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-TM-AS-MML: disable Subject: [spp] [PATCH 3/6] shared/sec: remove misunderstandable validate func X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spp-bounces@dpdk.org Sender: "spp" From: Yasufumi Ogawa Function `decode_str_value()` is not for decoding, but just validate length of given string. In addition, It just consists of four lines and used from two statements. This update is to remove almost nouse function. Signed-off-by: Yasufumi Ogawa --- .../secondary/spp_worker_th/cmd_parser.c | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.c b/src/shared/secondary/spp_worker_th/cmd_parser.c index 4ee8773..02528d6 100644 --- a/src/shared/secondary/spp_worker_th/cmd_parser.c +++ b/src/shared/secondary/spp_worker_th/cmd_parser.c @@ -258,17 +258,6 @@ get_vlan_uint_val(unsigned int *output, const char *arg_val, unsigned int min, return SPP_RET_OK; } -/* decoding procedure of string */ -static int -decode_str_value(char *output, const char *arg_val) -{ - if (strlen(arg_val) >= SPPWK_VAL_BUFSZ) - return SPP_RET_NG; - - strcpy(output, arg_val); - return SPP_RET_OK; -} - /* decoding procedure of port */ static int decode_port_value(void *output, const char *arg_val) @@ -344,7 +333,11 @@ decode_component_name_value(void *output, const char *arg_val, } } - return decode_str_value(component->name, arg_val); + if (strlen(arg_val) >= SPPWK_VAL_BUFSZ) + return SPP_RET_NG; + + strcpy(component->name, arg_val); + return SPP_RET_OK; } /* decoding procedure of core id for component command */ @@ -488,7 +481,11 @@ decode_port_name_value(void *output, const char *arg_val, return SPP_RET_NG; } - return decode_str_value(output, arg_val); + if (strlen(arg_val) >= SPPWK_VAL_BUFSZ) + return SPP_RET_NG; + + strcpy(output, arg_val); + return SPP_RET_OK; } /* decoding procedure of vlan operation for port command */ -- 2.17.1