[1/9] kvargs: detailed definition of callback prototype
Checks
Commit Message
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
(which prototype is arg_handler_t) parameter 'value' is NULL when
parsed 'only keys'.
But where there is no detailed definition of 'value' maybe NULL, so
this patch adds it.
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
lib/kvargs/rte_kvargs.h | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
@@ -36,7 +36,19 @@ extern "C" {
/** separator character used between key and value */
#define RTE_KVARGS_KV_DELIM "="
-/** Type of callback function used by rte_kvargs_process() */
+/**
+ * Callback prototype used by rte_kvargs_process().
+ *
+ * @param key
+ * The key to consider, it will not be NULL.
+ * @param value
+ * The value corresponding to the key, it may be NULL (e.g. only with key)
+ * @param opaque
+ * An opaque pointer coming from the caller.
+ * @return
+ * - >=0 handle key success.
+ * - <0 on error.
+ */
typedef int (*arg_handler_t)(const char *key, const char *value, void *opaque);
/** A key/value association */