From patchwork Sun Nov 20 01:08:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Venekamp X-Patchwork-Id: 1706684 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ChCoxcy1; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NFCFV2mtcz23mg for ; Sun, 20 Nov 2022 12:13:18 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UneRqs8QsBVQ765Lq19ehMP04VspNIgweTbJ5igZDDA=; b=ChCoxcy1TLDKYX 5hQT9byICvHTajW/71PzGjwtQztQP0T0BKw/zYIDJbF32umHDgHek5ZuSUjvIqwZsmME4Hj35f9Ut VP+l07IBH7Oqae4s99xCCZw7HPcV22pvl3QM6n9/bgaHQm5E4DdoThKA0kf+ukyU0gU30DYr9jTol hT+YbiDv2E9ix4IFRtv19LiaHZ2QCBZsfngRt9+xoAb7OjHlpLIdQZ8lphnb44rKzcMa/M4Hl/F9J YvANKcMvG5ooBM54hxfrXyHkFKzKzugE0/G490SayRGq8NgqQWJb490FpH5HZ5IFQ1w3FaLlCiFVq /l+dQ/pXXgn67ttIwBLw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1owYrC-000pcE-Gm; Sun, 20 Nov 2022 01:10:51 +0000 Received: from virt1.bvwebdesign.nl ([149.210.228.112]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1owYp5-000p5s-6H for openwrt-devel@lists.openwrt.org; Sun, 20 Nov 2022 01:08:41 +0000 Received: from localhost.localdomain (84-31-67-158.cable.dynamic.v4.ziggo.nl [84.31.67.158]) by virt1.bvwebdesign.nl (Postfix) with ESMTPSA id 80DEAA5ED76 for ; Sun, 20 Nov 2022 02:08:29 +0100 (CET) From: Jan Venekamp To: openwrt-devel@lists.openwrt.org Subject: [PATCH v2 9/9] uci: macro uci_alloc_element not in uci.h Date: Sun, 20 Nov 2022 02:08:28 +0100 Message-Id: <20221120010828.23765-10-jan@venekamp.net> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20221120010828.23765-1-jan@venekamp.net> References: <20221120010828.23765-1-jan@venekamp.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221119_170839_381556_225B313D X-CRM114-Status: UNSURE ( 9.12 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The macro uci_alloc_element is in the public header file uci.h. However, the macros output refers to uci_alloc_generic wich is in uci_internal.h and not public. Thus, uci_alloc_element should be priva [...] Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org The macro uci_alloc_element is in the public header file uci.h. However, the macros output refers to uci_alloc_generic wich is in uci_internal.h and not public. Thus, uci_alloc_element should be private as well and moved to uci_internal.h. Signed-off-by: Jan Venekamp --- uci.h | 10 ---------- uci_internal.h | 3 +++ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/uci.h b/uci.h index b385e2b..d0374f2 100644 --- a/uci.h +++ b/uci.h @@ -613,16 +613,6 @@ BUILD_CAST(option) #define uci_to_option(ptr) container_of(ptr, struct uci_option, e) #endif -/** - * uci_alloc_element: allocate a generic uci_element, reserve a buffer and typecast - * @ctx: uci context - * @type: {package,section,option} - * @name: string containing the name of the element - * @datasize: additional buffer size to reserve at the end of the struct - */ -#define uci_alloc_element(ctx, type, name, datasize) \ - uci_to_ ## type (uci_alloc_generic(ctx, uci_type_ ## type, name, sizeof(struct uci_ ## type) + datasize)) - #define uci_dataptr(ptr) \ (((char *) ptr) + sizeof(*ptr)) diff --git a/uci_internal.h b/uci_internal.h index 34528f0..ff4ee8c 100644 --- a/uci_internal.h +++ b/uci_internal.h @@ -42,6 +42,9 @@ struct uci_parse_context #define pctx_char(pctx, i) ((pctx)->buf[(i)]) #define pctx_cur_char(pctx) pctx_char(pctx, pctx_pos(pctx)) +#define uci_alloc_element(ctx, type, name, datasize) \ + uci_to_ ## type (uci_alloc_generic(ctx, uci_type_ ## type, name, sizeof(struct uci_ ## type) + datasize)) + extern const char *uci_confdir; extern const char *uci_savedir;