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 9A3D143EDB; Mon, 22 Apr 2024 17:24:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DDBF140DFB; Mon, 22 Apr 2024 17:24:06 +0200 (CEST) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mails.dpdk.org (Postfix) with ESMTP id 974D440A72 for ; Mon, 22 Apr 2024 17:23:53 +0200 (CEST) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6ed691fb83eso3558147b3a.1 for ; Mon, 22 Apr 2024 08:23:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1713799433; x=1714404233; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MPx8Tq4z+i1E7ZA5J+6800hQ4t64aBB2SM01FOQj28E=; b=j2MvXtpR15DNbeyaM4/UXzI2PajJGFECqHEVs/+ZQE9DntHfRDySVLR8sJ4vQ4QHPW mqNTL9pM1nuIX5CAYxvgynlpdc96LhJNuNllVz8/J4aKIGUQDy//VLbXNkJxb8sYX4J9 mXmRRjeOQhi2u9HHaXyokgQUXgWMTm7mlpsrsIo81CQ+GJKOG2YIejkoQs0X+5MjLY+1 M5t//B1pU/lDrbQ62BKufzT4YkUqqI7rVGTi38emcqR2xxJUt+SXFdjvx0iLsWkARVWg IiULQWiUcvg5iH8ew+TYEki6+lL90LUgWBzaVotoXcXiyKN6BKBHPoa5BsO1tOcDnjO3 MLew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713799433; x=1714404233; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MPx8Tq4z+i1E7ZA5J+6800hQ4t64aBB2SM01FOQj28E=; b=nyKV0wPNf0Wl7tjK703fZMGUMGnDxV73ixg95j+/NIDODuGB+3BvPrLdWORMltFx21 kX1o51tZZZwn6OCdsEfm2wLYMVfd3Jj4gqbF/Favdf46H6627++Do8EqiPs8UEqKiV7w PclIYYss82r+ee02KUV0/ohUq97fYdfl+6htnkCvg9UZe2QpCuvvCUY17oNZ/HqHEwy6 87cPy+dG8tWIsfc1GvTeJl6FLx0uInpy7+DOU0SrMb7yFqIp+JcNfZSW8H5kVg6nc53F +fpyWOvqI3SeuJT2SRe+JKL0wcshhUEWB/A3Mff+QnogOHjlLBGlq+HG3WEsSeSWbFJV FWlg== X-Gm-Message-State: AOJu0YwVUIo0yIK4/0gaf+bvhC6SYHkUC7ZJb80goeHSQyfxtnvCFEBW jRwF6uQsv1PAH6oB2hMXRIu6EmGBauQX34zVPIdn0cbg51gJL4Z5Q5l0MaeDxzDcvE4FvtkUjU2 T X-Google-Smtp-Source: AGHT+IEX3ZIUBbEs6BW2dRvkXhaWRvJHUQFSj5GAMPawlaY4t+EPK9MF50ejiBYJ0QKIITfPD8ARbg== X-Received: by 2002:a05:6a21:2d09:b0:1a9:8b4a:b84 with SMTP id tw9-20020a056a212d0900b001a98b4a0b84mr12417019pzb.18.1713799432775; Mon, 22 Apr 2024 08:23:52 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id cb17-20020a056a02071100b0060063c4be3bsm1402783pgb.14.2024.04.22.08.23.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 08:23:52 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Reshma Pattan Subject: [PATCH v5 8/9] test: use initialization in latencystats test Date: Mon, 22 Apr 2024 08:21:38 -0700 Message-ID: <20240422152336.147553-9-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240422152336.147553-1-stephen@networkplumber.org> References: <20240408195036.182545-1-stephen@networkplumber.org> <20240422152336.147553-1-stephen@networkplumber.org> MIME-Version: 1.0 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 No need for loop and memset() here. Just use structure initialization. Remove unnecessary initializations. Signed-off-by: Stephen Hemminger --- app/test/test_latencystats.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/app/test/test_latencystats.c b/app/test/test_latencystats.c index c309ab194f..3369c8bb90 100644 --- a/app/test/test_latencystats.c +++ b/app/test/test_latencystats.c @@ -21,7 +21,7 @@ static uint16_t portid; static struct rte_ring *ring; -static struct rte_metric_name lat_stats_strings[] = { +static struct rte_metric_name lat_stats_strings[NUM_STATS] = { {"min_latency_ns"}, {"avg_latency_ns"}, {"max_latency_ns"}, @@ -70,13 +70,9 @@ static int test_latency_uninit(void) /* Test case to get names of latency stats */ static int test_latencystats_get_names(void) { - int ret = 0, i = 0; - int size = 0; - struct rte_metric_name names[NUM_STATS]; - - size_t m_size = sizeof(struct rte_metric_name); - for (i = 0; i < NUM_STATS; i++) - memset(&names[i], 0, m_size); + int ret, i; + uint16_t size; + struct rte_metric_name names[NUM_STATS] = { }; /* Success Test: Valid names and size */ size = NUM_STATS; @@ -106,13 +102,9 @@ static int test_latencystats_get_names(void) /* Test case to get latency stats values */ static int test_latencystats_get(void) { - int ret = 0, i = 0; - int size = 0; - struct rte_metric_value values[NUM_STATS]; - - size_t v_size = sizeof(struct rte_metric_value); - for (i = 0; i < NUM_STATS; i++) - memset(&values[i], 0, v_size); + int ret; + uint16_t size; + struct rte_metric_value values[NUM_STATS] = { }; /* Success Test: Valid values and valid size */ size = NUM_STATS; -- 2.43.0