From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id +Lx2C1n3A2HEgwEAgWs5BA (envelope-from ) for ; Fri, 30 Jul 2021 14:58:01 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id sLf/Bln3A2EBMgAAbx9fmQ (envelope-from ) for ; Fri, 30 Jul 2021 12:58:01 +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)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E39B4DCA3 for ; Fri, 30 Jul 2021 14:58:00 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 07E9729235; Fri, 30 Jul 2021 08:57:00 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id D344F291FB for ; Fri, 30 Jul 2021 08:56:28 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id CBDBE5FD17; Fri, 30 Jul 2021 08:56:28 -0400 (EDT) Received: (nullmailer pid 2166866 invoked by uid 1000); Fri, 30 Jul 2021 12:56:10 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 02/27] lib: split notmuch_query_create Date: Fri, 30 Jul 2021 09:55:42 -0300 Message-Id: <20210730125607.2165433-3-david@tethera.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210730125607.2165433-1-david@tethera.net> References: <20210730125607.2165433-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: DIVH22ILHCHCHHFP5D3MMQAQ2SOA6WUC X-Message-ID-Hash: DIVH22ILHCHCHHFP5D3MMQAQ2SOA6WUC 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=1627649881; 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=VGg9x6yG9JQRFpHi4cvWqi2RVXe23jTuFIu2idf9DDyWxVa2Bn6uuwVo2EgqxenyUa6Th4 KKSkc7cdQuszHq/evXry+lAkau13HAmh6ZtDr25k0yEqf9EOQmDXwcA79APmE7L0kSNfCp nsSqRxyv3zCDIgWWw0EewddTMHjl8TUuX+MxAQd6NmiHPAYEdJY+ykKMjIrEwt/XSYXSp0 eFiIMZBO3VYlhA4VHAkbD2qN3b6r8rp3/NUminqRHid4b9sJZi6T7zQbg/CcjMlejT4Tgm NJExJqj0+jnMkpsxu6jrxDtFkvBSrNvIY0lncEwpXmC8Z1pl542irv+DejNP0A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1627649881; a=rsa-sha256; cv=none; b=r2pPbhB5gMT7EapijD9MDTXGoQiQ50wdVqQ7NIrD67PZ1bDN5/yc4MgmkHnbl+Vs4bRgYj y9Y3YBXu1BzIsCVJFJhl5nO+XcEFaxRB8h1yLWQfC6bxIk5/DuKJAN69l2LfAbIeWTwp7D GCWbwrlsTzU9cPRa/T3I/OvChMaILQyW2gLcBILLWP2QTbRxmsIKknFxfEf0L3i+MuHZad qq1U85d3javPW3CkBtpiSzfW7AkZIrZ/4KJ9qPHayicaZYf7uhSoUhYpsDbm2L9ozmV+zH BoWEf6H+IgrfqfZBlqCnM6/ddQq3yDvYk105bU/1QznRi7kbdZX5O9hbARKlwg== ARC-Authentication-Results: i=1; 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-Spam-Score: 0.49 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: E39B4DCA3 X-Spam-Score: 0.49 X-Migadu-Scanner: scn1.migadu.com X-TUID: ItQ3ItZbL45D 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