From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by dpdk.org (Postfix) with ESMTP id BA3A868CD for ; Tue, 28 Jan 2014 17:05:54 +0100 (CET) Received: by mail-wg0-f43.google.com with SMTP id y10so1182534wgg.22 for ; Tue, 28 Jan 2014 08:07:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZBqCHn8Z1u+a8NQzloO9NJ8pixvicW1exIjDi306W/0=; b=KbsLve1+DYWcuvy1sLRSs4u7C3OfwuZ7LQqLY325bs71f5cgG1lSSxhHC9UaFCLYGv YacB85HS5N0ZFQ0f7R10U5rB4vtVUfB35S5KIPrIceD8rycrTrywu0DhTAI4N0rsV7z7 63EIqPHfP9Zjudm+ups3gP5T0HjDYQKZmu3kAf7hz4H9TqZydtD28FMwZNt9Jf7xS67H JdiCF/3gET18ZcdSc90tBhXM3uThThn8FoSrt1xJIPRAB20RKkLE0zjdSUDMGH0RJrn1 fG4SmVW5EHjcSPVTT8ZiT/m6wNmNYfoOeKiMFuGLbcYu/lGdtyrFzYldJPLXmrTuI0C1 Jluw== X-Gm-Message-State: ALoCoQkCWPOoiHMDX3WTttWj+aconkq1fEX9VnmxbhVibVCvHA+TcjRkKrlT6qJ5rrp0RnWQHc0C X-Received: by 10.194.78.179 with SMTP id c19mr78686wjx.84.1390925233246; Tue, 28 Jan 2014 08:07:13 -0800 (PST) Received: from glumotte.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id d6sm36407821wic.9.2014.01.28.08.07.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jan 2014 08:07:12 -0800 (PST) From: Olivier Matz To: dev@dpdk.org Date: Tue, 28 Jan 2014 17:06:37 +0100 Message-Id: <1390925204-10800-5-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 1.8.4.rc3 In-Reply-To: <1390925204-10800-1-git-send-email-olivier.matz@6wind.com> References: <1390925204-10800-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH 04/11] kvargs: remove useless size field X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jan 2014 16:05:55 -0000 This value was not very useful as the size of the table is fixed (equals RTE_KVARGS_MAX). By the way, the memset in the initialization function was wrong (size too short). Even if it was not really an issue since we rely on the "count" field, it is now fixed by this patch. Signed-off-by: Olivier Matz --- lib/librte_kvargs/rte_kvargs.c | 5 ++--- lib/librte_kvargs/rte_kvargs.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/librte_kvargs/rte_kvargs.c b/lib/librte_kvargs/rte_kvargs.c index 935698c..0bf46fe 100644 --- a/lib/librte_kvargs/rte_kvargs.c +++ b/lib/librte_kvargs/rte_kvargs.c @@ -48,8 +48,7 @@ int rte_kvargs_init(struct rte_kvargs *kvlist) { kvlist->count = 0; - kvlist->size = RTE_KVARGS_MAX; - memset(kvlist->pairs, 0, kvlist->size); + memset(kvlist->pairs, 0, sizeof(kvlist->pairs)); return 0; } @@ -64,7 +63,7 @@ rte_kvargs_add_pair(struct rte_kvargs *kvlist, char *key, char *val) struct rte_kvargs_pair* entry; /* is the list full? */ - if (kvlist->count >= kvlist->size) { + if (kvlist->count >= RTE_KVARGS_MAX) { RTE_LOG(ERR, PMD, "Couldn't add %s, key/value list is full\n", key); return -1; } diff --git a/lib/librte_kvargs/rte_kvargs.h b/lib/librte_kvargs/rte_kvargs.h index 804ea1d..577f00b 100644 --- a/lib/librte_kvargs/rte_kvargs.h +++ b/lib/librte_kvargs/rte_kvargs.h @@ -71,7 +71,6 @@ struct rte_kvargs_pair { /** Store a list of key/value associations */ struct rte_kvargs { unsigned count; /**< number of entries in the list */ - size_t size; /**< maximum number of entries */ struct rte_kvargs_pair pairs[RTE_KVARGS_MAX]; /**< list of key/values */ }; -- 1.8.4.rc3