summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOlivier Matz <olivier.matz@6wind.com>2014-01-28 17:06:37 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2014-02-04 15:40:35 +0100
commit6b0bc51b8fe1785890bce4652b42ad285d647a21 (patch)
tree1b03f6075fff14890a7c14c7499dbc0bcb44e9c4 /lib
parent1ca8892c0d463c40f0daf0855fd4f61d229e33a9 (diff)
downloaddpdk-6b0bc51b8fe1785890bce4652b42ad285d647a21.zip
dpdk-6b0bc51b8fe1785890bce4652b42ad285d647a21.tar.gz
dpdk-6b0bc51b8fe1785890bce4652b42ad285d647a21.tar.xz
kvargs: remove useless size field
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 <olivier.matz@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/librte_kvargs/rte_kvargs.c5
-rw-r--r--lib/librte_kvargs/rte_kvargs.h1
2 files changed, 2 insertions, 4 deletions
diff --git a/lib/librte_kvargs/rte_kvargs.c b/lib/librte_kvargs/rte_kvargs.c
index c3d65af..b05a9bc 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 288e05f..3540e03 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 */
};