]> git.droids-corp.org - dpdk.git/commitdiff
kvargs: remove useless size field
authorOlivier Matz <olivier.matz@6wind.com>
Tue, 28 Jan 2014 16:06:37 +0000 (17:06 +0100)
committerDavid Marchand <david.marchand@6wind.com>
Wed, 26 Feb 2014 10:01:14 +0000 (11:01 +0100)
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>
lib/librte_kvargs/rte_kvargs.c
lib/librte_kvargs/rte_kvargs.h

index c3d65af780ebe1a8c4c757ccff2aefd99442bb93..b05a9bc88a95a685b633c1cb041a3495251ca09a 100644 (file)
@@ -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;
        }
index 288e05f5c90754a7fefdbe66c95bbcd730e38a07..3540e034ca9bfb4df6ba1b4ed3b8f12704ded8d9 100644 (file)
@@ -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 */
 };