mirror of https://github.com/djcb/mu.git
* cosmetic
This commit is contained in:
parent
191630b302
commit
5fb08c66d1
|
@ -30,7 +30,8 @@
|
||||||
#include "mu-maildir.h"
|
#include "mu-maildir.h"
|
||||||
|
|
||||||
#define MU_MAILDIR_WALK_MAX_FILE_SIZE (32*1000*1000)
|
#define MU_MAILDIR_WALK_MAX_FILE_SIZE (32*1000*1000)
|
||||||
#define MU_MAILDIR_NOINDEX_FILE ".noindex"
|
#define MU_MAILDIR_NOINDEX_FILE ".noindex"
|
||||||
|
#define MU_MAILDIR_CACHE_FILE ".mu.cache"
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -259,7 +260,7 @@ _is_maildir_new_or_cur (const char *path)
|
||||||
|
|
||||||
/* check if there is a noindex file (MU_WALK_NOINDEX_FILE) in this dir; */
|
/* check if there is a noindex file (MU_WALK_NOINDEX_FILE) in this dir; */
|
||||||
static gboolean
|
static gboolean
|
||||||
has_noindex_file (const char *path)
|
_has_noindex_file (const char *path)
|
||||||
{
|
{
|
||||||
char *fname;
|
char *fname;
|
||||||
|
|
||||||
|
@ -336,22 +337,22 @@ process_dir_entry (const char* path, struct dirent *entry,
|
||||||
|
|
||||||
case DT_DIR: {
|
case DT_DIR: {
|
||||||
/* if it has a noindex file, we ignore this dir */
|
/* if it has a noindex file, we ignore this dir */
|
||||||
if (has_noindex_file (fullpath)) {
|
if (_has_noindex_file (fullpath)) {
|
||||||
g_debug ("ignoring dir %s", fullpath);
|
g_debug ("ignoring dir %s", fullpath);
|
||||||
return MU_OK;
|
return MU_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return process_dir (fullpath, cb_msg, cb_dir, data);
|
return process_dir (fullpath, cb_msg, cb_dir, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return MU_OK; /* ignore other types */
|
return MU_OK; /* ignore other types */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct dirent*
|
static struct dirent*
|
||||||
dirent_copy (struct dirent *entry)
|
_dirent_copy (struct dirent *entry)
|
||||||
{
|
{
|
||||||
struct dirent *d = g_slice_new (struct dirent);
|
struct dirent *d = g_slice_new (struct dirent);
|
||||||
/* NOTE: simply memcpy'ing sizeof(struct dirent) bytes will
|
/* NOTE: simply memcpy'ing sizeof(struct dirent) bytes will
|
||||||
|
@ -360,13 +361,13 @@ dirent_copy (struct dirent *entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dirent_destroy (struct dirent *entry)
|
_dirent_destroy (struct dirent *entry)
|
||||||
{
|
{
|
||||||
g_slice_free(struct dirent, entry);
|
g_slice_free(struct dirent, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
dirent_cmp (struct dirent *d1, struct dirent *d2)
|
_dirent_cmp (struct dirent *d1, struct dirent *d2)
|
||||||
{
|
{
|
||||||
return d1->d_ino - d2->d_ino;
|
return d1->d_ino - d2->d_ino;
|
||||||
}
|
}
|
||||||
|
@ -398,14 +399,14 @@ process_dir (const char* path, MuMaildirWalkMsgCallback msg_cb,
|
||||||
some filesystems, such as ext3fs */
|
some filesystems, such as ext3fs */
|
||||||
lst = NULL;
|
lst = NULL;
|
||||||
while ((entry = readdir (dir)))
|
while ((entry = readdir (dir)))
|
||||||
lst = g_list_prepend (lst, dirent_copy(entry));
|
lst = g_list_prepend (lst, _dirent_copy(entry));
|
||||||
|
|
||||||
c = lst = g_list_sort (lst, (GCompareFunc)dirent_cmp);
|
c = lst = g_list_sort (lst, (GCompareFunc)_dirent_cmp);
|
||||||
for (c = lst, result = MU_OK; c && result == MU_OK; c = c->next)
|
for (c = lst, result = MU_OK; c && result == MU_OK; c = c->next)
|
||||||
result = process_dir_entry (path, (struct dirent*)c->data,
|
result = process_dir_entry (path, (struct dirent*)c->data,
|
||||||
msg_cb, dir_cb, data);
|
msg_cb, dir_cb, data);
|
||||||
|
|
||||||
g_list_foreach (lst, (GFunc)dirent_destroy, NULL);
|
g_list_foreach (lst, (GFunc)_dirent_destroy, NULL);
|
||||||
g_list_free (lst);
|
g_list_free (lst);
|
||||||
|
|
||||||
closedir (dir);
|
closedir (dir);
|
||||||
|
|
|
@ -137,7 +137,7 @@ MuMsgFieldType mu_msg_field_type (const MuMsgField *field) G_GNUC_CONST;
|
||||||
gboolean mu_msg_field_is_numeric (const MuMsgField *field) G_GNUC_CONST;
|
gboolean mu_msg_field_is_numeric (const MuMsgField *field) G_GNUC_CONST;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* is the field Xapian-enabled? That is, should this field be stored
|
\ * is the field Xapian-enabled? That is, should this field be stored
|
||||||
* (as a string) in the Xapian database?
|
* (as a string) in the Xapian database?
|
||||||
*
|
*
|
||||||
* @param field a MuMsgField
|
* @param field a MuMsgField
|
||||||
|
|
Loading…
Reference in New Issue