[PATCH v2 01/83] lib: update documentation of XXX_free() functions
Stephen Hemminger
stephen at networkplumber.org
Mon Jan 24 18:45:57 CET 2022
These functions all behave like libc free() and do
nothing if handed a NULL pointer. The code is already doing
this, this patch just documents the behavior.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
lib/hash/rte_hash.h | 3 +++
lib/kvargs/rte_kvargs.h | 2 ++
lib/mbuf/rte_mbuf.h | 2 ++
lib/mempool/rte_mempool.h | 2 ++
lib/ring/rte_ring.h | 2 ++
5 files changed, 11 insertions(+)
diff --git a/lib/hash/rte_hash.h b/lib/hash/rte_hash.h
index 6067aad95431..94223cf81ae0 100644
--- a/lib/hash/rte_hash.h
+++ b/lib/hash/rte_hash.h
@@ -174,6 +174,9 @@ rte_hash_find_existing(const char *name);
/**
* De-allocate all memory used by hash table.
+ *
+ * If the pointer is NULL, the function does nothing.
+ *
* @param h
* Hash table to free
*/
diff --git a/lib/kvargs/rte_kvargs.h b/lib/kvargs/rte_kvargs.h
index 359a9f5b091c..bf1732ce2b1e 100644
--- a/lib/kvargs/rte_kvargs.h
+++ b/lib/kvargs/rte_kvargs.h
@@ -108,6 +108,8 @@ struct rte_kvargs *rte_kvargs_parse_delim(const char *args,
* Free a rte_kvargs structure previously allocated with
* rte_kvargs_parse().
*
+ * If the pointer is NULL, the function does nothing.
+ *
* @param kvlist
* The rte_kvargs structure. No error if NULL.
*/
diff --git a/lib/mbuf/rte_mbuf.h b/lib/mbuf/rte_mbuf.h
index dedf83c38d1b..cb280108d3f9 100644
--- a/lib/mbuf/rte_mbuf.h
+++ b/lib/mbuf/rte_mbuf.h
@@ -1372,6 +1372,8 @@ rte_pktmbuf_free_seg(struct rte_mbuf *m)
* Free an mbuf, and all its segments in case of chained buffers. Each
* segment is added back into its original mempool.
*
+ * If the pointer is NULL, the function does nothing.
+ *
* @param m
* The packet mbuf to be freed. If NULL, the function does nothing.
*/
diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h
index 1e7a3c15273c..c268328b268b 100644
--- a/lib/mempool/rte_mempool.h
+++ b/lib/mempool/rte_mempool.h
@@ -1099,6 +1099,8 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size,
* memory referenced by the mempool. The objects must not be used by
* other cores as they will be freed.
*
+ * If the pointer is NULL, the function does nothing.
+ *
* @param mp
* A pointer to the mempool structure.
*/
diff --git a/lib/ring/rte_ring.h b/lib/ring/rte_ring.h
index da17ed6d7c04..c2faf7b3e6dc 100644
--- a/lib/ring/rte_ring.h
+++ b/lib/ring/rte_ring.h
@@ -176,6 +176,8 @@ struct rte_ring *rte_ring_create(const char *name, unsigned int count,
/**
* De-allocate all memory used by the ring.
*
+ * If the pointer is NULL, the function does nothing.
+ *
* @param r
* Ring to free
*/
--
2.30.2
More information about the dev
mailing list