From e7b1c4665fd02259d5bd43213fa9b8565d25a169 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 9 Feb 2022 11:17:13 -0800 Subject: [PATCH] lib: update documentation of some *_free functions 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 --- lib/hash/rte_hash.h | 4 +++- lib/mempool/rte_mempool.h | 1 + lib/ring/rte_ring.h | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/hash/rte_hash.h b/lib/hash/rte_hash.h index 6067aad954..7fa9702742 100644 --- a/lib/hash/rte_hash.h +++ b/lib/hash/rte_hash.h @@ -174,8 +174,10 @@ rte_hash_find_existing(const char *name); /** * De-allocate all memory used by hash table. + * * @param h - * Hash table to free + * Hash table to free, if NULL, the function does nothing. + * */ void rte_hash_free(struct rte_hash *h); diff --git a/lib/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h index 1e7a3c1527..1d3cdf7f22 100644 --- a/lib/mempool/rte_mempool.h +++ b/lib/mempool/rte_mempool.h @@ -1101,6 +1101,7 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size, * * @param mp * A pointer to the mempool structure. + * If NULL then, the function does nothing. */ void rte_mempool_free(struct rte_mempool *mp); diff --git a/lib/ring/rte_ring.h b/lib/ring/rte_ring.h index ab6b4244c8..980e92e594 100644 --- a/lib/ring/rte_ring.h +++ b/lib/ring/rte_ring.h @@ -193,7 +193,8 @@ struct rte_ring *rte_ring_create(const char *name, unsigned int count, * De-allocate all memory used by the ring. * * @param r - * Ring to free + * Ring to free. + * If NULL then, the function does nothing. */ void rte_ring_free(struct rte_ring *r); -- 2.20.1