From bb932fa2173d08774e835e4d6bed3ed5103a181f Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Mon, 20 Jan 2020 12:32:29 +0200 Subject: [PATCH] mu: don't need a path argument for index We get it from the store. --- lib/mu-index.c | 15 +++++++++------ lib/mu-index.h | 6 ++---- mu/mu-cmd-index.c | 3 ++- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/mu-index.c b/lib/mu-index.c index 24f425f2..b789c88c 100644 --- a/lib/mu-index.c +++ b/lib/mu-index.c @@ -331,18 +331,19 @@ mu_index_set_max_msg_size (MuIndex *index, guint max_size) MuError -mu_index_run (MuIndex *index, const char *path, - gboolean reindex, gboolean lazycheck, +mu_index_run (MuIndex *index, gboolean reindex, gboolean lazycheck, MuIndexStats *stats, MuIndexMsgCallback msg_cb, MuIndexDirCallback dir_cb, void *user_data) { - MuIndexCallbackData cb_data; - MuError rv; + MuIndexCallbackData cb_data; + MuError rv; + const char *path; g_return_val_if_fail (index && index->_store, MU_ERROR); g_return_val_if_fail (msg_cb, MU_ERROR); + path = mu_store_maildir (index->_store); if (!check_path (path)) return MU_ERROR; @@ -390,15 +391,17 @@ on_stats_maildir_file (const char *fullpath, const char *mdir, MuError -mu_index_stats (MuIndex *index, const char *path, +mu_index_stats (MuIndex *index, MuIndexStats *stats, MuIndexMsgCallback cb_msg, MuIndexDirCallback cb_dir, void *user_data) { - MuIndexCallbackData cb_data; + const char *path; + MuIndexCallbackData cb_data; g_return_val_if_fail (index, MU_ERROR); g_return_val_if_fail (cb_msg, MU_ERROR); + path = mu_store_maildir (index->_store); if (!check_path (path)) return MU_ERROR; diff --git a/lib/mu-index.h b/lib/mu-index.h index 7a93fbf4..df3919c2 100644 --- a/lib/mu-index.h +++ b/lib/mu-index.h @@ -106,7 +106,6 @@ typedef MuError (*MuIndexDirCallback) (const char* path, gboolean enter, * start the indexing process * * @param index a valid MuIndex instance - * @param path the path to index. This must be an absolute path * @param force if != 0, force re-indexing already index messages; this is * obviously a lot slower than only indexing new/changed messages * @param lazycheck whether ignore subdirectoryies that have up-to-date @@ -123,7 +122,7 @@ typedef MuError (*MuIndexDirCallback) (const char* path, gboolean enter, * MU_STOP if the user stopped or MU_ERROR in * case of some error. */ -MuError mu_index_run (MuIndex *index, const char *path, gboolean force, +MuError mu_index_run (MuIndex *index, gboolean force, gboolean lazycheck, MuIndexStats *stats, MuIndexMsgCallback msg_cb, MuIndexDirCallback dir_cb, void *user_data); @@ -135,7 +134,6 @@ MuError mu_index_run (MuIndex *index, const char *path, gboolean force, * mu_index_run sees, when there are updates in the Maildir * * @param index a valid MuIndex instance - * @param path the path to get stats for; this must be an absolute path * @param stats a structure with some statistics about the results; * note that this function does *not* reset the struct values to allow * for cumulative stats from multiple calls. If needed, you can use @@ -148,7 +146,7 @@ MuError mu_index_run (MuIndex *index, const char *path, gboolean force, * MU_STOP if the user stopped or MU_ERROR in * case of some error. */ -MuError mu_index_stats (MuIndex *index, const char *path, MuIndexStats *stats, +MuError mu_index_stats (MuIndex *index, MuIndexStats *stats, MuIndexMsgCallback msg_cb, MuIndexDirCallback dir_cb, void *user_data); diff --git a/mu/mu-cmd-index.c b/mu/mu-cmd-index.c index 6ddd55aa..dbe190c4 100644 --- a/mu/mu-cmd-index.c +++ b/mu/mu-cmd-index.c @@ -305,7 +305,8 @@ cmd_index (MuIndex *midx, MuConfig *opts, MuIndexStats *stats, GError **err) newline_before_on(); - rv = mu_index_run (midx, opts->maildir, opts->rebuild, + rv = mu_index_run (midx, + opts->rebuild, opts->lazycheck, stats, show_progress ? (MuIndexMsgCallback)index_msg_cb :