From nobody Fri Nov 01 16:11:35 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xg5TM3Stzz5c2Jg; Fri, 01 Nov 2024 16:11:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xg5TM30jQz3xKC; Fri, 1 Nov 2024 16:11:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730477495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jImiQCUBin9DROI9Z5KaDb8xKXCFJen00H4Sh3y8uM8=; b=D4+DHBRUrv3vTjyvGDpldt9lgeLrQD6V0Nl+ClWOIOzRB4DkmRvMVUFPE/OlXyfcQl8nYy 1h8aRGE0ubpd4HPR56AJC1TOKnfQXW7BIu2wkQoG/U/+wSdsCHwPDS+qC03Sr/6ZUW9CDR FhopOPzcwJx+VwdciNSfGtHq1Vs2R4AaBmT8wshhVFm9F1Pk6iZpWvNU4tJ4DPjIq1dG7T nmh5cWeBGkefiEDvTaZBm8Da2BnoRawSZTOwGMr776xg7AjuwSnMN7E7qsD+lKNGdJLA4r lKu5QBbsDyhGjMxhpfVX+Je9QycrtEjzEikaE2nWqa25Z91VNQe2M88YweLUEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730477495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=jImiQCUBin9DROI9Z5KaDb8xKXCFJen00H4Sh3y8uM8=; b=P/NwHNbauacqCDGH5ukFDg/GdJzBqrlrw4H/V5zN/isfSdyh+TKBvLt7UrUflR+4Tye7ZG fF1cO019PsfIky5P9wIvmrHrXpZfjHWALhkj95ZTH2yho3EKw34m9p0AvHQS2pNDvZbSUD dBT6zQfVTxY2tyWy+pukvW5yFJ7+Ya7FsHat02mUeYx8E7iqzuRX13Xk5ShPTMgeYgCawd kbBe2mEr3Yiy0n1H39N4EsrdgD9ZO8+43buKVy2WePf9BnGK7sWWzZVMeQC1q1t0s2YUap 85ouuEZEJVbfaz40r7qoqCTaJDY8CHiYUXZ09Xpd4KVA8LDke9AiN3BRg7P3vA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730477495; a=rsa-sha256; cv=none; b=Med+15Qf+xXT0o309jHKpyI1kr+lbXusnoky8RC7O9w+ah8EMjm64Q5zaepyA5Wgdq54Uc bUcht35WD9c9SqMx8ubjFii1lVAopRgfwJwPNVqfFGxnYScbnGnhrYgyL3GLzzm0cBBzuA K4XVuFnFOCbYx8+0rvzhGmKGv9C245W/RHjX/8lJDBrJngR7S+eX0QGVP7Ix8wllQRhLnN mfSi+y3eyQ97dvbblh818xRDKTxgiw8fCq9Q8GQPXmBWEitoT3f37EWvR0wS5xiy01V9vP vf5U0ZbUabr6dbVQmpDnRn8rj9ofLhVtOUrVophVKK0nqA81asyj27bMjCq4rg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Xg5TM2cNYzS1B; Fri, 1 Nov 2024 16:11:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4A1GBZus080093; Fri, 1 Nov 2024 16:11:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4A1GBZWN080090; Fri, 1 Nov 2024 16:11:35 GMT (envelope-from git) Date: Fri, 1 Nov 2024 16:11:35 GMT Message-Id: <202411011611.4A1GBZWN080090@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: b2dbd3d3ae33 - main - pctrie: reduce code duplication in PCTRIE_REMOVE_* List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b2dbd3d3ae33286baa3ce4a07bd697c50b450e7a Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=b2dbd3d3ae33286baa3ce4a07bd697c50b450e7a commit b2dbd3d3ae33286baa3ce4a07bd697c50b450e7a Author: Doug Moore AuthorDate: 2024-11-01 16:10:19 +0000 Commit: Doug Moore CommitDate: 2024-11-01 16:10:19 +0000 pctrie: reduce code duplication in PCTRIE_REMOVE_* There's a little bit of code that appears in each PCTRIE_REMOVE function in pctrie.h. Make a new function for it, and invoke it from those PCTRIE_REMOVE functions. Reviewed by: bnovkov Differential Revision: https://reviews.freebsd.org/D47320 --- sys/sys/pctrie.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/sys/pctrie.h b/sys/sys/pctrie.h index 54b7fb401202..8556f08561b9 100644 --- a/sys/sys/pctrie.h +++ b/sys/sys/pctrie.h @@ -311,6 +311,14 @@ name##_PCTRIE_ITER_STEP_LE(struct pctrie_iter *it) \ } \ \ static __inline __unused void \ +name##_PCTRIE_REMOVE_BASE(struct pctrie *ptree, \ + struct pctrie_node *freenode) \ +{ \ + if (freenode != NULL) \ + freefn(ptree, freenode); \ +} \ + \ +static __inline __unused void \ name##_PCTRIE_ITER_REMOVE(struct pctrie_iter *it) \ { \ uint64_t *val; \ @@ -319,8 +327,7 @@ name##_PCTRIE_ITER_REMOVE(struct pctrie_iter *it) \ val = pctrie_iter_remove(it, &freenode); \ if (val == NULL) \ panic("%s: key not found", __func__); \ - if (freenode != NULL) \ - freefn(it->ptree, freenode); \ + name##_PCTRIE_REMOVE_BASE(it->ptree, freenode); \ } \ \ static __inline __unused struct type * \ @@ -340,8 +347,7 @@ name##_PCTRIE_REMOVE(struct pctrie *ptree, uint64_t key) \ val = pctrie_remove_lookup(ptree, key, &freenode); \ if (val == NULL) \ panic("%s: key not found", __func__); \ - if (freenode != NULL) \ - freefn(ptree, freenode); \ + name##_PCTRIE_REMOVE_BASE(ptree, freenode); \ } \ \ static __inline __unused struct type * \ @@ -351,8 +357,7 @@ name##_PCTRIE_REMOVE_LOOKUP(struct pctrie *ptree, uint64_t key) \ struct pctrie_node *freenode; \ \ val = pctrie_remove_lookup(ptree, key, &freenode); \ - if (freenode != NULL) \ - freefn(ptree, freenode); \ + name##_PCTRIE_REMOVE_BASE(ptree, freenode); \ return name##_PCTRIE_VAL2PTR(val); \ }