From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id S2vSLAxWFWF3OQEAgWs5BA (envelope-from ) for ; Thu, 12 Aug 2021 19:10:36 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id SJUEKAxWFWHLcgAA1q6Kng (envelope-from ) for ; Thu, 12 Aug 2021 17:10:36 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (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 70C2A3718 for ; Thu, 12 Aug 2021 19:10:36 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id A590F2C04A; Thu, 12 Aug 2021 13:09:32 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 8288C291FD for ; Thu, 12 Aug 2021 13:09:25 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 615945FD5C; Thu, 12 Aug 2021 13:09:25 -0400 (EDT) Received: (nullmailer pid 1348724 invoked by uid 1000); Thu, 12 Aug 2021 17:07:43 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 02/31] lib: split notmuch_query_create Date: Thu, 12 Aug 2021 10:06:59 -0700 Message-Id: <20210812170728.1348333-3-david@tethera.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210812170728.1348333-1-david@tethera.net> References: <20210812170728.1348333-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: 3LLXMJIWOMZEN3IW7K6M25I5IOBBXN35 X-Message-ID-Hash: 3LLXMJIWOMZEN3IW7K6M25I5IOBBXN35 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=1628788236; 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=EiMSwf1fLT8aAzYfAOmimTeWSLmQL1uq0QhL8fqNktt01IzGTqiSvjWZm9Y9MgXR01FUYv a+WQLeMnHqaNdJ3y5xRx2CHv1J7EoKvZjdl8u1EoNpjDpQDvisrEu87M2G3c6k3UTsMfPr bOAf8EFcEEEH8IORzq0LK/MTbo8+aw8VyShTYoH+6kiadPLC4dvI+yb/k8HqnOqKe9fzhm mRzlWvfO4wYYnHZs9xiyVNRCXoi0AHHYftpnEj4xuas36uTquXEoZKZr4iu+NvZ+PQGaAg EOoUbH9B33631Iv258IE/m+ugwfBK6b2g+MY8e9BQLo6ih6/gGnqKzqBqEJ17Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1628788236; a=rsa-sha256; cv=none; b=Ld6psTNqf4p4dYqD6qZA9WieQTE6mQ8UMWiPc1zXfX4WAasdTrBGyWZ5lqxxQiL4VOV6Ka kpWsYgYUQ2KZJmSxKeLWeLdZ2Tum3EMv5WPNAaH0IhDr67rAGTQJ/drwV7j0jpktwIHB3c GLnm6Smu4M10D0vRE088T1m8lSNIgsKIZT1rk0lWv5Hl6VOGg5sOhUvPBBykdQqBJJLdO+ GWATm+yXrE7EmWsztGY7spETicjV8u0m/CWrMXcK6w9OkekCAO14narfafNU+ccB+pVN1H MFDVSxlb4ymaySZD97fKJS89shbs0wFWPHHuwis+7ZqarfNU92u4ebEqsHOsig== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: 0.56 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 70C2A3718 X-Spam-Score: 0.56 X-Migadu-Scanner: scn0.migadu.com X-TUID: 65P0WC6e4DLj 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