From patchwork Mon Jan 24 17:45:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 106359 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 52B5DA04AD; Mon, 24 Jan 2022 18:47:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6DD38427DD; Mon, 24 Jan 2022 18:47:25 +0100 (CET) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id C717140040 for ; Mon, 24 Jan 2022 18:47:23 +0100 (CET) Received: by mail-pl1-f180.google.com with SMTP id c3so16311102pls.5 for ; Mon, 24 Jan 2022 09:47:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iQDMti0C/zCmytBoY0TBHcFMELXFLxnste1k0DLf55E=; b=EGjGPdC0WNWlqFujJPTs26UI4e8Uk8INGYuEny0yLmc6D8OC15X1PovK6tnVNKxPQ2 qS7ZnYvd0/1QqnJwhztoftztxW3dUPb9DgCqB74m4Wwjc/Vcspl9TeHkfObTyWZtwrcD +xbLW+CZa+dE/4F884MqkDyEB+YsemPyJK1KPB5q5Q4VRcW3Dt8zl+saLBrV+/LTi3Rp yWXj4UpdR4YZVQFhZ+TLdewCxeXaRO6vW2ambkHCE44LU+TSJvoXQ3yOsurAF3OcKS+v fvvnJvqN9YJBxkf63jwDiD+jW/rnuCheSpiiEKR2grJf1Jop1WEVgzb90L4aHjzfL+bX 7YBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iQDMti0C/zCmytBoY0TBHcFMELXFLxnste1k0DLf55E=; b=wqhfpEtKJnNjpl740l5AbViQ9Hac3G4TeMjPiSnNcSrI4BC8zJ+wbrmU8qGhWTEJtH ALjtwpT4E2aYC3OYxPdNA/Rm4ceUH+pFk80dYXLEBT1O4bHHn19Ymwc2RTIrUcHAlOWX fjmla9Apw3+S/K0TXNLSEWGWEKwGWw5a7Q2NX7qsO9yt5Q8Vp6bDuK5lQBhWEf6nJkSJ v4zcWmnMJM5kDkUnj00uEcJvjYfNmXtS9oGiSGFI5N+fWgZwVhbzvBBg4gr0pJNP57tx D8WwAZrgNLaib5R1aqGRttLSjMLkJfw0dOyaG9YapmSMYN5MfAaX2g/r9rrHlppdHqvB fpwg== X-Gm-Message-State: AOAM531QWbd/eAYalrBcO9VsoITa6I/pHwt0eUwHygW2XtzS4MXU+rBw f5BgP2YLq7nOoVnBbY2FXwsvOR79SUTDyA== X-Google-Smtp-Source: ABdhPJzMKAwupj7tHAkHxjdpuV3CC2d4kaEANp1fjuievq2ccOaDC02B41+WxU6dspsBuj/ydysxEQ== X-Received: by 2002:a17:90a:1196:: with SMTP id e22mr2964287pja.241.1643046442826; Mon, 24 Jan 2022 09:47:22 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id q7sm15835082pfs.37.2022.01.24.09.47.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jan 2022 09:47:22 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Yipeng Wang , Sameh Gobriel , Bruce Richardson , Vladimir Medvedkin , Olivier Matz , Andrew Rybchenko , Honnappa Nagarahalli , Konstantin Ananyev Subject: [PATCH v2 01/83] lib: update documentation of XXX_free() functions Date: Mon, 24 Jan 2022 09:45:57 -0800 Message-Id: <20220124174719.14417-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220124174719.14417-1-stephen@networkplumber.org> References: <20220124000518.319850-1-stephen@networkplumber.org> <20220124174719.14417-1-stephen@networkplumber.org> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 | 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 */