From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mI0iOokOJWGJ4wAAgWs5BA (envelope-from ) for ; Tue, 24 Aug 2021 17:21:45 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id iIPNNYkOJWFIbgAAB5/wlQ (envelope-from ) for ; Tue, 24 Aug 2021 15:21:45 +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)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 51ADF84BD for ; Tue, 24 Aug 2021 17:21:45 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id E405420569; Tue, 24 Aug 2021 11:20:52 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id AAF1120554 for ; Tue, 24 Aug 2021 11:20:42 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 8E81F5FD5C; Tue, 24 Aug 2021 11:20:42 -0400 (EDT) Received: (nullmailer pid 2942832 invoked by uid 1000); Tue, 24 Aug 2021 15:17:51 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 03/36] lib: split notmuch_query_create Date: Tue, 24 Aug 2021 08:17:12 -0700 Message-Id: <20210824151745.2941868-4-david@tethera.net> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210824151745.2941868-1-david@tethera.net> References: <20210824151745.2941868-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: LYS7P7OO7QX53CTFZMI4QWM27GJKZLDO X-Message-ID-Hash: LYS7P7OO7QX53CTFZMI4QWM27GJKZLDO 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=1629818505; 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=+fGQ4nOoMDUv1xQCShr3xLPKzk3gbNVnqSAaXgHmYWg=; b=cIywUPjeytzK9O9N5kCJBnzJGy3KYpUzTTE1Tsr5w2erRiDuz1qTqsb6fWP/bW4WIefLgt SdYWYzgMJYEkQbEmGZgL0ttmpBO5AB2TuKuR1CtFdQiBj7doKZDKT12nHfrcPLydKbIZQF IBBSniMxVCWXstn5ip18MTu5humPaCeM/cWpHm6XgfqXGS0QktZAWZorV4hE63I49v46IA qWI78L5v6ygT3mYrt910ldmLSJG5pvk8da1wNRDWb3Ml3l6uYxhLN1lrf48p9vJXVG2Ak1 DWECFYMkWe6X+TkOLVli/0MaxyJ+Mz7BSRiv02pSvUbGuIhECz6d26oWVoo3YQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1629818505; a=rsa-sha256; cv=none; b=DcCDhp9h95VJO0NNykLBoqAIqvCacHfFTFoH+TgXSNJylb7NVoxdnfVU0MMJWFdZqp2Zf2 eLEg4XB1u/JYbRTk+IM60HmQ2GobCpNEWY6HwtcnPs4PeCi4Rs/fs63lMVOAqQIu5rGnHp HHKIkxDakZMbOVyHQ9+La5TPUyfKl0AOe5LhfLW4yfAbwVaqSJvd5X25nhA115giTF9S6M V2RpyuI6e4Wv7ropXQqSQ1aFy3n3nN6ERZqC1FNt+IU8dyvHA69gn6Rp2DisIt01cXnEq7 Y6i7+XwdnZGsazKgx1mhyEOIFKL8jwDZrWU4YkhjzzNhvn6akGEGLW+ThzL+9w== 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.93 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: 51ADF84BD X-Spam-Score: -0.93 X-Migadu-Scanner: scn0.migadu.com X-TUID: 6rM4VZMROZcr 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.32.0