From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id ECuaAkAdA2CbJQAA0tVLHw (envelope-from ) for ; Sat, 16 Jan 2021 17:07:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id cE0SOj8dA2CAQgAA1q6Kng (envelope-from ) for ; Sat, 16 Jan 2021 17:07:11 +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) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 74423940481 for ; Sat, 16 Jan 2021 17:07:11 +0000 (UTC) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 46A382BFC7; Sat, 16 Jan 2021 12:05:25 -0500 (EST) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 19B7E2BF71 for ; Sat, 16 Jan 2021 12:04:45 -0500 (EST) Received: by fethera.tethera.net (Postfix, from userid 1001) id 12E025FF47; Sat, 16 Jan 2021 12:04:45 -0500 (EST) Received: (nullmailer pid 842429 invoked by uid 1000); Sat, 16 Jan 2021 17:04:16 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 25/38] cli/compact: convert to new configuration framework Date: Sat, 16 Jan 2021 13:03:53 -0400 Message-Id: <20210116170406.842014-26-david@tethera.net> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210116170406.842014-1-david@tethera.net> References: <20210116170406.842014-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: XRKJ55F23H75E7ZABTEHO7RZ7CVIV7C3 X-Message-ID-Hash: XRKJ55F23H75E7ZABTEHO7RZ7CVIV7C3 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 X-Migadu-Spam-Score: -0.87 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: 74423940481 X-Spam-Score: -0.87 X-Migadu-Scanner: scn1.migadu.com X-TUID: 3FdPwKEW8Q2q Switch to the newly created API function notmuch_database_compact_db, which takes the database opened in main(). --- notmuch-compact.c | 7 +++---- notmuch.c | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/notmuch-compact.c b/notmuch-compact.c index ab2066e1..361583db 100644 --- a/notmuch-compact.c +++ b/notmuch-compact.c @@ -27,9 +27,8 @@ status_update_cb (const char *msg, unused (void *closure)) } int -notmuch_compact_command (notmuch_config_t *config, unused(notmuch_database_t *notmuch), int argc, char *argv[]) +notmuch_compact_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[]) { - const char *path = notmuch_config_get_database_path (config); const char *backup_path = NULL; notmuch_status_t ret; bool quiet = false; @@ -55,8 +54,8 @@ notmuch_compact_command (notmuch_config_t *config, unused(notmuch_database_t *no if (! quiet) printf ("Compacting database...\n"); - ret = notmuch_database_compact (path, backup_path, - quiet ? NULL : status_update_cb, NULL); + ret = notmuch_database_compact_db (notmuch, backup_path, + quiet ? NULL : status_update_cb, NULL); if (ret) { fprintf (stderr, "Compaction failed: %s\n", notmuch_status_to_string (ret)); return EXIT_FAILURE; diff --git a/notmuch.c b/notmuch.c index 913fd312..3a299afa 100644 --- a/notmuch.c +++ b/notmuch.c @@ -163,7 +163,7 @@ static command_t commands[] = { "Create a plain-text dump of the tags for each message." }, { "restore", notmuch_restore_command, NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE, "Restore the tags from the given dump file (see 'dump')." }, - { "compact", notmuch_compact_command, NOTMUCH_COMMAND_CONFIG_OPEN, + { "compact", notmuch_compact_command, NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE, "Compact the notmuch database." }, { "reindex", notmuch_reindex_command, NOTMUCH_COMMAND_DATABASE_EARLY | NOTMUCH_COMMAND_DATABASE_WRITE, "Re-index all messages matching the search terms." }, -- 2.29.2