From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id k3OOJ74p7mD8egAAgWs5BA (envelope-from ) for ; Wed, 14 Jul 2021 02:03:10 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id qNOYIr4p7mAsbgAAbx9fmQ (envelope-from ) for ; Wed, 14 Jul 2021 00:03:10 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [144.217.243.247]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 54CB2CC5F for ; Wed, 14 Jul 2021 02:03:10 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 3B925290D5; Tue, 13 Jul 2021 20:03:00 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 2A822290C9 for ; Tue, 13 Jul 2021 20:02:45 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 24C7F5FD21; Tue, 13 Jul 2021 20:02:45 -0400 (EDT) Received: (nullmailer pid 804650 invoked by uid 1000); Wed, 14 Jul 2021 00:02:42 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 02/11] lib: split notmuch_query_create Date: Tue, 13 Jul 2021 21:02:30 -0300 Message-Id: <20210714000239.804384-3-david@tethera.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210714000239.804384-1-david@tethera.net> References: <20210714000239.804384-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: VGB6Y2LEFMEVB6IYO74ZIEEL7EZECNP3 X-Message-ID-Hash: VGB6Y2LEFMEVB6IYO74ZIEEL7EZECNP3 X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1626220990; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=hb9RaqpWsTlevcxFvpglPVwMFyAJeKZ7u3vCGv1yTSo=; b=fSJY9tXNokiI3tP0Lha5vYUuSAmknZ47zUsujLuzscqKYSL5Qj4oyMF+CLHdYKL6REjNRv 8jFC6lq9N8CC79VP1kQmRRu1KDHIYFSB5jm8RwrkEpOAlxyQyAyMnPlTlM0udeW/O0P6Y3 DHJBLgP7tTlWXWMVDQ+vTF4+XC2oTh2iHHD01ENQlaQGIDSGstvr5AHcRn6n0R+H5oTOoM pBihSJN3zMYnsxnQMQrTIaJlgV4mQR70nA5kMX2EZVL2VGLRQncLbxqWK30AqWWG1iVL2x u0Nx9fSPmr4YElUhoel9BTfQ0x56QS2JFEz/MOobjOLnFmSOFqigKtWMufgVJQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1626220990; a=rsa-sha256; cv=none; b=qJn7jfIQb8zKbLQqRX5mGUyFRaqj5SCGfJR+3WmWD0JnDrGOPvnRVMgAmf7MA3RlvVCVrs wv7hfNQYvTk8vz/EYmOG9uh7DTjMwnmSKcltLV2+VDeAZA8chVrNN5cTcbVngdM73U9RtN 9P2K7Zl5dj3YIckDF/p7ohYxHTlXLrLx4ZbxXaq1bPNL8V8qZo7v4VTTAJo/eX4bveTc6n U+fB0SnVsm8vkmfl5b/Cc3/xJ88M4I1o24uSr/8tRemo050ZbJw7i4DTwGi/axpguOev4y mw/2frNMjmAT87aY0lsLHcKAKpm3g8iiMSUnpxOJim/3oFs4U1FpjKXC479xJg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.08 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 144.217.243.247 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 54CB2CC5F X-Spam-Score: -1.08 X-Migadu-Scanner: scn0.migadu.com X-TUID: FZjjy/RRpNGS Most of the function will be re-usable when creating a query from an s-expression. --- lib/query.cc | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/query.cc b/lib/query.cc index 792aba21..39b85e91 100644 --- a/lib/query.cc +++ b/lib/query.cc @@ -84,9 +84,9 @@ _notmuch_query_destructor (notmuch_query_t *query) return 0; } -notmuch_query_t * -notmuch_query_create (notmuch_database_t *notmuch, - const char *query_string) +static notmuch_query_t * +_notmuch_query_constructor (notmuch_database_t *notmuch, + const char *query_string) { notmuch_query_t *query; @@ -116,6 +116,19 @@ notmuch_query_create (notmuch_database_t *notmuch, return query; } +notmuch_query_t * +notmuch_query_create (notmuch_database_t *notmuch, + const char *query_string) +{ + + notmuch_query_t *query = _notmuch_query_constructor (notmuch, query_string); + + if (! query) + return NULL; + + return query; +} + static notmuch_status_t _notmuch_query_ensure_parsed (notmuch_query_t *query) { -- 2.30.2