* *.c: rename _prefixed function into non-prefixed ones (violates ISO)

This commit is contained in:
Dirk-Jan C. Binnema
2010-01-15 22:11:51 +02:00
parent 223e3f95b0
commit da1e9a3841
9 changed files with 106 additions and 109 deletions

View File

@ -34,7 +34,7 @@
#include "mu-util.h" #include "mu-util.h"
static MuCmd static MuCmd
_cmd_from_string (const char* cmd) cmd_from_string (const char* cmd)
{ {
if (!cmd) if (!cmd)
return MU_CMD_UNKNOWN; return MU_CMD_UNKNOWN;
@ -67,7 +67,7 @@ _cmd_from_string (const char* cmd)
static gboolean static gboolean
_print_query (MuQueryXapian *xapian, const gchar *query) print_query (MuQueryXapian *xapian, const gchar *query)
{ {
char *querystr; char *querystr;
@ -82,7 +82,7 @@ _print_query (MuQueryXapian *xapian, const gchar *query)
static const gchar* static const gchar*
_display_field (MuMsgXapian *row, const MuMsgField* field) display_field (MuMsgXapian *row, const MuMsgField* field)
{ {
gint64 val; gint64 val;
@ -119,7 +119,7 @@ _display_field (MuMsgXapian *row, const MuMsgField* field)
/* returns NULL if there is an error */ /* returns NULL if there is an error */
const MuMsgField* const MuMsgField*
_sort_field_from_string (const char* fieldstr) sort_field_from_string (const char* fieldstr)
{ {
const MuMsgField *field; const MuMsgField *field;
@ -138,7 +138,7 @@ _sort_field_from_string (const char* fieldstr)
static gboolean static gboolean
_print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts) print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts)
{ {
MuMsgXapian *row; MuMsgXapian *row;
const MuMsgField *sortfield; const MuMsgField *sortfield;
@ -147,7 +147,7 @@ _print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts)
sortfield = NULL; sortfield = NULL;
if (opts->sortfield) { if (opts->sortfield) {
sortfield = _sort_field_from_string (opts->sortfield); sortfield = sort_field_from_string (opts->sortfield);
if (!sortfield) /* error occured? */ if (!sortfield) /* error occured? */
return FALSE; return FALSE;
} }
@ -177,7 +177,7 @@ _print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts)
printlen += printf ("%c", *fields); printlen += printf ("%c", *fields);
else else
printlen += printf ("%s", printlen += printf ("%s",
_display_field(row, field)); display_field(row, field));
++fields; ++fields;
} }
@ -195,7 +195,7 @@ _print_rows (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts)
static gboolean static gboolean
_do_output_text (MuQueryXapian *xapian, MuConfigOptions* opts, do_output_text (MuQueryXapian *xapian, MuConfigOptions* opts,
const gchar **params) const gchar **params)
{ {
gchar *query; gchar *query;
@ -206,9 +206,9 @@ _do_output_text (MuQueryXapian *xapian, MuConfigOptions* opts,
/* if xquery is set, we print the xapian query instead of the /* if xquery is set, we print the xapian query instead of the
* output; this is for debugging purposes */ * output; this is for debugging purposes */
if (opts->xquery) if (opts->xquery)
retval = _print_query (xapian, query); retval = print_query (xapian, query);
else else
retval = _print_rows (xapian, query, opts); retval = print_rows (xapian, query, opts);
g_free (query); g_free (query);
@ -219,7 +219,7 @@ _do_output_text (MuQueryXapian *xapian, MuConfigOptions* opts,
/* create a linksdir if it not exist yet; if it already existed, /* create a linksdir if it not exist yet; if it already existed,
* remove old links if opts->clearlinks was specified */ * remove old links if opts->clearlinks was specified */
static gboolean static gboolean
_create_or_clear_linksdir_maybe (MuConfigOptions* opts) create_or_clear_linksdir_maybe (MuConfigOptions* opts)
{ {
if (access (opts->linksdir, F_OK) != 0) { if (access (opts->linksdir, F_OK) != 0) {
@ -233,7 +233,7 @@ _create_or_clear_linksdir_maybe (MuConfigOptions* opts)
} }
static gboolean static gboolean
_do_output_links (MuQueryXapian *xapian, MuConfigOptions* opts, do_output_links (MuQueryXapian *xapian, MuConfigOptions* opts,
const gchar **params) const gchar **params)
{ {
gchar *query; gchar *query;
@ -241,7 +241,7 @@ _do_output_links (MuQueryXapian *xapian, MuConfigOptions* opts,
MuMsgXapian *row; MuMsgXapian *row;
const MuMsgField *pathfield; const MuMsgField *pathfield;
if (!_create_or_clear_linksdir_maybe (opts)) if (!create_or_clear_linksdir_maybe (opts))
return FALSE; return FALSE;
query = mu_query_xapian_combine (params, FALSE); query = mu_query_xapian_combine (params, FALSE);
@ -287,7 +287,7 @@ _do_output_links (MuQueryXapian *xapian, MuConfigOptions* opts,
static gboolean static gboolean
_query_params_valid (MuConfigOptions *opts) query_params_valid (MuConfigOptions *opts)
{ {
if (opts->linksdir) if (opts->linksdir)
if (opts->xquery) { if (opts->xquery) {
@ -311,13 +311,13 @@ _query_params_valid (MuConfigOptions *opts)
gboolean gboolean
_cmd_find (MuConfigOptions *opts) cmd_find (MuConfigOptions *opts)
{ {
MuQueryXapian *xapian; MuQueryXapian *xapian;
gboolean rv; gboolean rv;
const gchar **params; const gchar **params;
if (!_query_params_valid (opts)) if (!query_params_valid (opts))
return FALSE; return FALSE;
/* first param is 'query', search params are after that */ /* first param is 'query', search params are after that */
@ -333,9 +333,9 @@ _cmd_find (MuConfigOptions *opts)
} }
if (opts->linksdir) if (opts->linksdir)
rv = _do_output_links (xapian, opts, params); rv = do_output_links (xapian, opts, params);
else else
rv = _do_output_text (xapian, opts, params); rv = do_output_text (xapian, opts, params);
mu_query_xapian_destroy (xapian); mu_query_xapian_destroy (xapian);
mu_msg_gmime_uninit(); mu_msg_gmime_uninit();
@ -345,7 +345,7 @@ _cmd_find (MuConfigOptions *opts)
static gboolean static gboolean
_check_index_params (MuConfigOptions *opts) check_index_params (MuConfigOptions *opts)
{ {
if (opts->linksdir || opts->xquery) { if (opts->linksdir || opts->xquery) {
g_warning ("Invalid option(s) for command"); g_warning ("Invalid option(s) for command");
@ -363,7 +363,7 @@ _check_index_params (MuConfigOptions *opts)
static MuResult static MuResult
_index_msg_cb (MuIndexStats* stats, void *user_data) index_msg_cb (MuIndexStats* stats, void *user_data)
{ {
char *kars="-\\|/"; char *kars="-\\|/";
char output[314]; char output[314];
@ -387,11 +387,11 @@ _index_msg_cb (MuIndexStats* stats, void *user_data)
static gboolean static gboolean
_cmd_index (MuConfigOptions *opts) cmd_index (MuConfigOptions *opts)
{ {
int rv; int rv;
if (!_check_index_params (opts)) if (!check_index_params (opts))
return FALSE; return FALSE;
mu_msg_gmime_init (); mu_msg_gmime_init ();
@ -412,17 +412,17 @@ _cmd_index (MuConfigOptions *opts)
rv = mu_index_run (midx, opts->maildir, rv = mu_index_run (midx, opts->maildir,
opts->reindex, &stats, opts->reindex, &stats,
opts->quiet ? NULL : _index_msg_cb, opts->quiet ? NULL : index_msg_cb,
NULL, NULL); NULL, NULL);
if (!opts->nocleanup) { if (!opts->nocleanup) {
stats._processed = 0; /* start over */ stats._processed = 0; /* start over */
mu_index_cleanup (midx, &stats, mu_index_cleanup (midx, &stats,
opts->quiet ? NULL : _index_msg_cb, opts->quiet ? NULL : index_msg_cb,
NULL); NULL);
} }
if (!opts->quiet) { if (!opts->quiet) {
_index_msg_cb (&stats, NULL); index_msg_cb (&stats, NULL);
g_print ("\n"); g_print ("\n");
} }
@ -439,7 +439,7 @@ _cmd_index (MuConfigOptions *opts)
MuResult MuResult
_cleanup_cb (MuIndexStats *stats, void *user_data) cleanup_cb (MuIndexStats *stats, void *user_data)
{ {
char *kars="-\\|/"; char *kars="-\\|/";
char output[100]; char output[100];
@ -464,7 +464,7 @@ _cleanup_cb (MuIndexStats *stats, void *user_data)
static int static int
_cmd_mkdir (MuConfigOptions *opts) cmd_mkdir (MuConfigOptions *opts)
{ {
int i; int i;
@ -492,7 +492,7 @@ _cmd_mkdir (MuConfigOptions *opts)
#if 0 /* currently, turned off */ #if 0 /* currently, turned off */
static gboolean static gboolean
_cmd_link (MuConfigOptions *opts) cmd_link (MuConfigOptions *opts)
{ {
if (!opts->params[0]) if (!opts->params[0])
return FALSE; /* shouldn't happen */ return FALSE; /* shouldn't happen */
@ -507,7 +507,7 @@ _cmd_link (MuConfigOptions *opts)
static gboolean static gboolean
_cmd_help (MuConfigOptions *opts) cmd_help (MuConfigOptions *opts)
{ {
/* FIXME: get context-sensitive help */ /* FIXME: get context-sensitive help */
_show_version (); _show_version ();
@ -515,7 +515,7 @@ _cmd_help (MuConfigOptions *opts)
} }
static gboolean static gboolean
_cmd_cleanup (MuConfigOptions *opts) cmd_cleanup (MuConfigOptions *opts)
{ {
int rv; int rv;
@ -557,7 +557,7 @@ _cmd_cleanup (MuConfigOptions *opts)
static gboolean static gboolean
_show_usage (gboolean noerror) show_usage (gboolean noerror)
{ {
const char* usage= const char* usage=
"usage: mu [options] command [parameters]\n" "usage: mu [options] command [parameters]\n"
@ -573,7 +573,7 @@ _show_usage (gboolean noerror)
} }
static gboolean static gboolean
_show_version (void) show_version (void)
{ {
const char* msg = const char* msg =
"mu (mail indexer / searcher version) " VERSION "\n\n" "mu (mail indexer / searcher version) " VERSION "\n\n"
@ -590,34 +590,31 @@ _show_version (void)
} }
gboolean gboolean
mu_cmd_execute (MuConfigOptions *opts) mu_cmd_execute (MuConfigOptions *opts)
{ {
MuCmd cmd; MuCmd cmd;
if (opts->version) if (opts->version)
return _show_version (); return show_version ();
if (!opts->params||!opts->params[0]) /* no command? */ if (!opts->params||!opts->params[0]) /* no command? */
return _show_usage (FALSE); return show_usage (FALSE);
cmd = _cmd_from_string (opts->params[0]); cmd = cmd_from_string (opts->params[0]);
switch (cmd) { switch (cmd) {
case MU_CMD_INDEX: return _cmd_index (opts); case MU_CMD_INDEX: return cmd_index (opts);
case MU_CMD_FIND: return _cmd_find (opts); case MU_CMD_FIND: return cmd_find (opts);
case MU_CMD_MKDIR: return _cmd_mkdir (opts); case MU_CMD_MKDIR: return cmd_mkdir (opts);
/* case MU_CMD_CLEANUP: return _cmd_cleanup (opts); */ /* case MU_CMD_CLEANUP: return _cmd_cleanup (opts); */
/* case MU_CMD_HELP: return _cmd_help (opts); */ /* case MU_CMD_HELP: return _cmd_help (opts); */
/* case MU_CMD_LINK: return _cmd_link (opts); */ /* case MU_CMD_LINK: return _cmd_link (opts); */
case MU_CMD_UNKNOWN: return _show_usage (FALSE); case MU_CMD_UNKNOWN: return show_usage (FALSE);
default: default:
g_return_val_if_reached (FALSE); g_return_val_if_reached (FALSE);
} }

View File

@ -117,7 +117,7 @@ mu_config_init (MuConfigOptions *opts)
} }
static gchar* static gchar*
_guess_muhome (void) guess_muhome (void)
{ {
const char* home; const char* home;
@ -140,7 +140,7 @@ mu_config_set_defaults (MuConfigOptions *opts)
g_return_if_fail (opts); g_return_if_fail (opts);
if (!opts->muhome) if (!opts->muhome)
opts->muhome = _guess_muhome (); opts->muhome = guess_muhome ();
/* note: xpath is is *not* settable from the cmdline */ /* note: xpath is is *not* settable from the cmdline */
opts->xpath = g_strdup_printf ("%s%c%s", opts->muhome,G_DIR_SEPARATOR, opts->xpath = g_strdup_printf ("%s%c%s", opts->muhome,G_DIR_SEPARATOR,

View File

@ -79,7 +79,7 @@ typedef struct _MuIndexCallbackData MuIndexCallbackData;
static MuResult static MuResult
_insert_or_update_maybe (const char* fullpath, time_t filestamp, insert_or_update_maybe (const char* fullpath, time_t filestamp,
MuIndexCallbackData *data, gboolean *updated) MuIndexCallbackData *data, gboolean *updated)
{ {
MuMsgGMime *msg; MuMsgGMime *msg;
@ -131,7 +131,7 @@ _insert_or_update_maybe (const char* fullpath, time_t filestamp,
} }
static MuResult static MuResult
_run_msg_callback_maybe (MuIndexCallbackData *data) run_msg_callback_maybe (MuIndexCallbackData *data)
{ {
if (data && data->_idx_msg_cb) { if (data && data->_idx_msg_cb) {
@ -153,12 +153,12 @@ on_run_maildir_msg (const char* fullpath, time_t filestamp,
MuResult result; MuResult result;
gboolean updated; gboolean updated;
result = _run_msg_callback_maybe (data); result = run_msg_callback_maybe (data);
if (result != MU_OK) if (result != MU_OK)
return result; return result;
/* see if we need to update/insert anything...*/ /* see if we need to update/insert anything...*/
result = _insert_or_update_maybe (fullpath, filestamp, data, result = insert_or_update_maybe (fullpath, filestamp, data,
&updated); &updated);
/* update statistics */ /* update statistics */
@ -205,7 +205,7 @@ on_run_maildir_dir (const char* fullpath, gboolean enter,
} }
static gboolean static gboolean
_check_path (const char* path) check_path (const char* path)
{ {
g_return_val_if_fail (path, FALSE); g_return_val_if_fail (path, FALSE);
@ -230,7 +230,7 @@ mu_index_run (MuIndex *index, const char* path,
g_return_val_if_fail (index && index->_xapian, MU_ERROR); g_return_val_if_fail (index && index->_xapian, MU_ERROR);
if (!_check_path (path)) if (!check_path (path))
return MU_ERROR; return MU_ERROR;
if (stats) if (stats)
@ -286,7 +286,7 @@ mu_index_stats (MuIndex *index, const char* path,
g_return_val_if_fail (index, MU_ERROR); g_return_val_if_fail (index, MU_ERROR);
if (!_check_path (path)) if (!check_path (path))
return MU_ERROR; return MU_ERROR;
if (stats) if (stats)
@ -317,7 +317,7 @@ typedef struct _CleanupData CleanupData;
static MuResult static MuResult
_foreach_doc_cb (const char* path, CleanupData *cudata) foreach_doc_cb (const char* path, CleanupData *cudata)
{ {
MuResult rv; MuResult rv;
@ -358,7 +358,7 @@ mu_index_cleanup (MuIndex *index, MuIndexStats *stats,
cudata._user_data = user_data; cudata._user_data = user_data;
rv = mu_store_xapian_foreach (index->_xapian, rv = mu_store_xapian_foreach (index->_xapian,
(MuStoreXapianForeachFunc)_foreach_doc_cb, (MuStoreXapianForeachFunc)foreach_doc_cb,
&cudata); &cudata);
mu_store_xapian_flush (index->_xapian); mu_store_xapian_flush (index->_xapian);

View File

@ -46,11 +46,11 @@ typedef struct _MuLog MuLog;
static MuLog* MU_LOG = NULL; static MuLog* MU_LOG = NULL;
static void _log_write (const char* domain, GLogLevelFlags level, static void log_write (const char* domain, GLogLevelFlags level,
const gchar *msg); const gchar *msg);
static void static void
_try_close (int fd) try_close (int fd)
{ {
if (fd < 0) if (fd < 0)
return; return;
@ -90,7 +90,7 @@ log_handler (const gchar* log_domain, GLogLevelFlags log_level,
if (log_level == G_LOG_LEVEL_DEBUG && !MU_LOG->_debug) if (log_level == G_LOG_LEVEL_DEBUG && !MU_LOG->_debug)
return; return;
_log_write (log_domain ? log_domain : "mu", log_level, msg); log_write (log_domain ? log_domain : "mu", log_level, msg);
} }
@ -139,7 +139,7 @@ mu_log_init (const char* muhome, gboolean append,
g_free (logfile); g_free (logfile);
if (fd < 0 || !mu_log_init_with_fd (fd, FALSE, quiet, debug)) { if (fd < 0 || !mu_log_init_with_fd (fd, FALSE, quiet, debug)) {
_try_close (fd); try_close (fd);
return FALSE; return FALSE;
} }
@ -154,7 +154,7 @@ mu_log_uninit (void)
g_return_if_fail (MU_LOG); g_return_if_fail (MU_LOG);
if (MU_LOG->_own) if (MU_LOG->_own)
_try_close (MU_LOG->_fd); try_close (MU_LOG->_fd);
g_free (MU_LOG); g_free (MU_LOG);
MU_LOG = NULL; MU_LOG = NULL;
@ -176,7 +176,7 @@ pfx (GLogLevelFlags level)
} }
static void static void
_log_write (const char* domain, GLogLevelFlags level, log_write (const char* domain, GLogLevelFlags level,
const gchar *msg) const gchar *msg)
{ {
time_t now; time_t now;

View File

@ -35,7 +35,7 @@
static gboolean static gboolean
_create_maildir (const char *path, int mode) create_maildir (const char *path, int mode)
{ {
int i; int i;
const gchar* subdirs[] = {"new", "cur", "tmp"}; const gchar* subdirs[] = {"new", "cur", "tmp"};
@ -69,7 +69,7 @@ _create_maildir (const char *path, int mode)
} }
static gboolean static gboolean
_create_noindex (const char *path) create_noindex (const char *path)
{ {
/* create a noindex file if requested */ /* create a noindex file if requested */
int fd; int fd;
@ -95,10 +95,10 @@ mu_maildir_mkmdir (const char* path, mode_t mode, gboolean noindex)
g_return_val_if_fail (path, FALSE); g_return_val_if_fail (path, FALSE);
if (!_create_maildir (path, mode)) if (!create_maildir (path, mode))
return FALSE; return FALSE;
if (noindex && !_create_noindex (path)) if (noindex && !create_noindex (path))
return FALSE; return FALSE;
return TRUE; return TRUE;
@ -107,7 +107,7 @@ mu_maildir_mkmdir (const char* path, mode_t mode, gboolean noindex)
/* determine whether the source message is in 'new' or in 'cur'; /* determine whether the source message is in 'new' or in 'cur';
* we ignore messages in 'tmp' for obvious reasons */ * we ignore messages in 'tmp' for obvious reasons */
static gboolean static gboolean
_check_subdir (const char *src, gboolean *in_cur) check_subdir (const char *src, gboolean *in_cur)
{ {
gchar *srcpath; gchar *srcpath;
@ -127,12 +127,12 @@ _check_subdir (const char *src, gboolean *in_cur)
} }
static gchar* static gchar*
_get_target_fullpath (const char* src, const gchar *targetpath) get_target_fullpath (const char* src, const gchar *targetpath)
{ {
gchar *targetfullpath, *srcfile, *srcpath, *c; gchar *targetfullpath, *srcfile, *srcpath, *c;
gboolean in_cur; gboolean in_cur;
if (!_check_subdir (src, &in_cur)) if (!check_subdir (src, &in_cur))
return NULL; return NULL;
/* note: make the filename *cough* unique by making the pathname /* note: make the filename *cough* unique by making the pathname
@ -170,7 +170,7 @@ mu_maildir_link (const char* src, const char *targetpath)
g_return_val_if_fail (src, FALSE); g_return_val_if_fail (src, FALSE);
g_return_val_if_fail (targetpath, FALSE); g_return_val_if_fail (targetpath, FALSE);
targetfullpath = _get_target_fullpath (src, targetpath); targetfullpath = get_target_fullpath (src, targetpath);
if (!targetfullpath) if (!targetfullpath)
return FALSE; return FALSE;
@ -237,7 +237,7 @@ process_file (const char* fullpath, MuMaildirWalkMsgCallback cb, void *data)
* (we're skipping 'tmp' for obvious reasons) * (we're skipping 'tmp' for obvious reasons)
*/ */
G_GNUC_CONST static gboolean G_GNUC_CONST static gboolean
_is_maildir_new_or_cur (const char *path) is_maildir_new_or_cur (const char *path)
{ {
size_t len; size_t len;
const char *sfx; const char *sfx;
@ -261,7 +261,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;
@ -283,7 +283,7 @@ _has_noindex_file (const char *path)
* this is slower (extra stat) but at least it works * this is slower (extra stat) but at least it works
*/ */
static gboolean static gboolean
_set_dtype (const char* path, struct dirent *entry) set_dtype (const char* path, struct dirent *entry)
{ {
struct stat statbuf; struct stat statbuf;
char fullpath[4096]; char fullpath[4096];
@ -311,7 +311,7 @@ _set_dtype (const char* path, struct dirent *entry)
static gboolean static gboolean
_ignore_dir_entry (struct dirent *entry) ignore_dir_entry (struct dirent *entry)
{ {
const char *name; const char *name;
@ -352,7 +352,7 @@ process_dir_entry (const char* path, struct dirent *entry,
char* fullpath; char* fullpath;
/* ignore special dirs: */ /* ignore special dirs: */
if (_ignore_dir_entry (entry)) if (ignore_dir_entry (entry))
return MU_OK; return MU_OK;
fullpath = g_newa (char, strlen(path) + strlen(entry->d_name) + 1); fullpath = g_newa (char, strlen(path) + strlen(entry->d_name) + 1);
@ -362,14 +362,14 @@ process_dir_entry (const char* path, struct dirent *entry,
switch (entry->d_type) { switch (entry->d_type) {
case DT_REG: case DT_REG:
/* we only want files in cur/ and new/ */ /* we only want files in cur/ and new/ */
if (!_is_maildir_new_or_cur (path)) if (!is_maildir_new_or_cur (path))
return MU_OK; return MU_OK;
return process_file (fullpath, cb_msg, data); return process_file (fullpath, cb_msg, data);
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;
} }
@ -384,7 +384,7 @@ process_dir_entry (const char* path, struct dirent *entry,
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
@ -393,13 +393,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;
} }
@ -434,17 +434,17 @@ process_dir (const char* path, MuMaildirWalkMsgCallback msg_cb,
/* handle FSs that don't support entry->d_type */ /* handle FSs that don't support entry->d_type */
if (entry->d_type == DT_UNKNOWN) if (entry->d_type == DT_UNKNOWN)
_set_dtype (path, entry); set_dtype (path, entry);
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);
@ -493,7 +493,7 @@ mu_maildir_walk (const char *path, MuMaildirWalkMsgCallback cb_msg,
static gboolean static gboolean
_clear_links (const gchar* dirname, DIR *dir) clear_links (const gchar* dirname, DIR *dir)
{ {
struct dirent *entry; struct dirent *entry;
gboolean rv; gboolean rv;
@ -510,7 +510,7 @@ _clear_links (const gchar* dirname, DIR *dir)
/* handle FSs that don't support entry->d_type */ /* handle FSs that don't support entry->d_type */
if (entry->d_type == DT_UNKNOWN) if (entry->d_type == DT_UNKNOWN)
_set_dtype (dirname, entry); set_dtype (dirname, entry);
/* ignore non-links / non-dirs */ /* ignore non-links / non-dirs */
if (entry->d_type != DT_LNK && entry->d_type != DT_DIR) if (entry->d_type != DT_LNK && entry->d_type != DT_DIR)
@ -553,7 +553,7 @@ mu_maildir_clear_links (const gchar* path)
g_debug ("remove symlinks from %s", path); g_debug ("remove symlinks from %s", path);
rv = _clear_links (path, dir); rv = clear_links (path, dir);
closedir (dir); closedir (dir);
return rv; return rv;

View File

@ -146,7 +146,7 @@ typedef gboolean (*FieldMatchFunc) (const MuMsgField *field,
gconstpointer data); gconstpointer data);
static const MuMsgField* static const MuMsgField*
_find_field (FieldMatchFunc matcher, gconstpointer data) find_field (FieldMatchFunc matcher, gconstpointer data)
{ {
int i; int i;
for (i = 0; i != sizeof(FIELD_DATA)/sizeof(FIELD_DATA[0]); ++i) for (i = 0; i != sizeof(FIELD_DATA)/sizeof(FIELD_DATA[0]); ++i)
@ -157,7 +157,7 @@ _find_field (FieldMatchFunc matcher, gconstpointer data)
} }
static gboolean static gboolean
_match_name (const MuMsgField *field, const gchar* name) match_name (const MuMsgField *field, const gchar* name)
{ {
return strcmp (field->_name, name) == 0; return strcmp (field->_name, name) == 0;
} }
@ -166,11 +166,11 @@ const MuMsgField*
mu_msg_field_from_name (const char* str) mu_msg_field_from_name (const char* str)
{ {
g_return_val_if_fail (str, NULL); g_return_val_if_fail (str, NULL);
return _find_field ((FieldMatchFunc)_match_name, str); return find_field ((FieldMatchFunc)match_name, str);
} }
static gboolean static gboolean
_match_shortcut (const MuMsgField *field, char kar) match_shortcut (const MuMsgField *field, char kar)
{ {
return field->_shortcut[0] == kar; return field->_shortcut[0] == kar;
} }
@ -178,7 +178,7 @@ _match_shortcut (const MuMsgField *field, char kar)
const MuMsgField* const MuMsgField*
mu_msg_field_from_shortcut (char kar) mu_msg_field_from_shortcut (char kar)
{ {
return _find_field ((FieldMatchFunc)_match_shortcut, return find_field ((FieldMatchFunc)match_shortcut,
GUINT_TO_POINTER((guint)kar)); GUINT_TO_POINTER((guint)kar));
} }
@ -191,7 +191,7 @@ match_id (const MuMsgField *field, MuMsgFieldId id)
const MuMsgField* const MuMsgField*
mu_msg_field_from_id (MuMsgFieldId id) mu_msg_field_from_id (MuMsgFieldId id)
{ {
return _find_field ((FieldMatchFunc)match_id, return find_field ((FieldMatchFunc)match_id,
GUINT_TO_POINTER(id)); GUINT_TO_POINTER(id));
} }

View File

@ -207,7 +207,7 @@ mu_msg_gmime_get_from (MuMsgGMime *msg)
static const char* static const char*
_get_recipient (MuMsgGMime *msg, GMimeRecipientType rtype, StringFields field) get_recipient (MuMsgGMime *msg, GMimeRecipientType rtype, StringFields field)
{ {
/* can only be set once */ /* can only be set once */
if (!msg->_fields[field]) { if (!msg->_fields[field]) {
@ -233,14 +233,14 @@ const char*
mu_msg_gmime_get_to (MuMsgGMime *msg) mu_msg_gmime_get_to (MuMsgGMime *msg)
{ {
g_return_val_if_fail (msg, NULL); g_return_val_if_fail (msg, NULL);
return _get_recipient (msg, GMIME_RECIPIENT_TYPE_TO, TO_FIELD); return get_recipient (msg, GMIME_RECIPIENT_TYPE_TO, TO_FIELD);
} }
const char* const char*
mu_msg_gmime_get_cc (MuMsgGMime *msg) mu_msg_gmime_get_cc (MuMsgGMime *msg)
{ {
g_return_val_if_fail (msg, NULL); g_return_val_if_fail (msg, NULL);
return _get_recipient (msg, GMIME_RECIPIENT_TYPE_CC, CC_FIELD); return get_recipient (msg, GMIME_RECIPIENT_TYPE_CC, CC_FIELD);
} }
@ -467,7 +467,7 @@ typedef struct _GetBodyData GetBodyData;
static gboolean static gboolean
_looks_like_attachment (GMimeObject *part) looks_like_attachment (GMimeObject *part)
{ {
const char *str; const char *str;
GMimeContentDisposition *disp; GMimeContentDisposition *disp;
@ -503,7 +503,7 @@ get_body_cb (GMimeObject *parent, GMimeObject *part, GetBodyData *data)
return; return;
} }
if (_looks_like_attachment (part)) if (looks_like_attachment (part))
return; /* not the body */ return; /* not the body */
/* is it right content type? */ /* is it right content type? */
@ -732,7 +732,7 @@ mu_msg_gmime_get_field_numeric (MuMsgGMime *msg, const MuMsgField* field)
static gboolean static gboolean
_fill_contact (MuMsgContact *contact, InternetAddress *addr, fill_contact (MuMsgContact *contact, InternetAddress *addr,
MuMsgContactType ctype) MuMsgContactType ctype)
{ {
if (!addr) if (!addr)
@ -752,7 +752,7 @@ _fill_contact (MuMsgContact *contact, InternetAddress *addr,
static int static int
_address_list_foreach (InternetAddressList *addrlist, address_list_foreach (InternetAddressList *addrlist,
MuMsgContactType ctype, MuMsgContactType ctype,
MuMsgGMimeContactsCallback cb, MuMsgGMimeContactsCallback cb,
void *ptr) void *ptr)
@ -765,7 +765,7 @@ _address_list_foreach (InternetAddressList *addrlist,
for (i = 0, rv = 0; i != internet_address_list_length(addrlist); ++i) { for (i = 0, rv = 0; i != internet_address_list_length(addrlist); ++i) {
MuMsgContact contact; MuMsgContact contact;
if (!_fill_contact(&contact, if (!fill_contact(&contact,
internet_address_list_get_address (addrlist, i), internet_address_list_get_address (addrlist, i),
ctype)) ctype))
{ {
@ -797,7 +797,7 @@ mu_msg_gmime_get_contacts_from (MuMsgGMime *msg, MuMsgGMimeContactsCallback cb,
list = internet_address_list_parse_string ( list = internet_address_list_parse_string (
g_mime_message_get_sender (msg->_mime_msg)); g_mime_message_get_sender (msg->_mime_msg));
rv = _address_list_foreach (list, MU_MSG_CONTACT_TYPE_FROM, cb, ptr); rv = address_list_foreach (list, MU_MSG_CONTACT_TYPE_FROM, cb, ptr);
if (list) if (list)
g_object_unref (G_OBJECT(list)); g_object_unref (G_OBJECT(list));
@ -831,7 +831,7 @@ mu_msg_gmime_get_contacts_foreach (MuMsgGMime *msg, MuMsgGMimeContactsCallback c
InternetAddressList *addrlist; InternetAddressList *addrlist;
addrlist = g_mime_message_get_recipients (msg->_mime_msg, addrlist = g_mime_message_get_recipients (msg->_mime_msg,
ctypes[i]._gmime_type); ctypes[i]._gmime_type);
rv = _address_list_foreach (addrlist, ctypes[i]._type,cb, ptr); rv = address_list_foreach (addrlist, ctypes[i]._type,cb, ptr);
if (rv != 0) if (rv != 0)
break; break;
} }

View File

@ -92,8 +92,8 @@ _get_query (MuQueryXapian * mqx, const char* searchexpr, int *err = 0) {
(searchexpr, (searchexpr,
Xapian::QueryParser::FLAG_BOOLEAN | Xapian::QueryParser::FLAG_BOOLEAN |
Xapian::QueryParser::FLAG_PHRASE | Xapian::QueryParser::FLAG_PHRASE |
Xapian::QueryParser::FLAG_LOVEHATE | // Xapian::QueryParser::FLAG_LOVEHATE |
Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE | // Xapian::QueryParser::FLAG_BOOLEAN_ANY_CASE |
Xapian::QueryParser::FLAG_WILDCARD | Xapian::QueryParser::FLAG_WILDCARD |
Xapian::QueryParser::FLAG_PURE_NOT | Xapian::QueryParser::FLAG_PURE_NOT |
Xapian::QueryParser::FLAG_PARTIAL); Xapian::QueryParser::FLAG_PARTIAL);

View File

@ -29,7 +29,7 @@
#include "mu-log.h" #include "mu-log.h"
static gboolean static gboolean
_init_log (MuConfigOptions *opts) init_log (MuConfigOptions *opts)
{ {
gboolean rv; gboolean rv;
@ -47,7 +47,7 @@ _init_log (MuConfigOptions *opts)
} }
static gboolean static gboolean
_parse_params (MuConfigOptions *config, int *argcp, char ***argvp) parse_params (MuConfigOptions *config, int *argcp, char ***argvp)
{ {
GError *error = NULL; GError *error = NULL;
GOptionContext *context; GOptionContext *context;
@ -88,10 +88,10 @@ main (int argc, char *argv[])
do { do {
rv = FALSE; rv = FALSE;
if (!_parse_params (&config, &argc, &argv)) if (!parse_params (&config, &argc, &argv))
break; break;
if (!_init_log (&config)) if (!init_log (&config))
break; break;
rv = mu_cmd_execute (&config); rv = mu_cmd_execute (&config);