mirror of https://github.com/djcb/mu.git
* <many>: use some gcc attributes (if applicable) for optimization
This commit is contained in:
parent
82db172e40
commit
61bc73f071
|
@ -20,6 +20,10 @@
|
|||
#ifndef __MU_BOOKMARKS_H__
|
||||
#define __MU_BOOKMARKS_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _MuBookmarks MuBookmarks;
|
||||
|
||||
|
||||
|
@ -31,8 +35,8 @@ typedef struct _MuBookmarks MuBookmarks;
|
|||
*
|
||||
* @return a new BookMarks object, or NULL in case of error
|
||||
*/
|
||||
MuBookmarks *mu_bookmarks_new (const gchar *bmpath);
|
||||
|
||||
MuBookmarks *mu_bookmarks_new (const gchar *bmpath)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* destroy a bookmarks object
|
||||
|
@ -66,5 +70,6 @@ typedef void (*MuBookmarksForeachFunc) (const gchar *key, const gchar *val,
|
|||
void mu_bookmarks_foreach (MuBookmarks *bm, MuBookmarksForeachFunc func,
|
||||
gpointer user_data);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /*__MU_BOOKMARKS_H__*/
|
||||
|
|
|
@ -51,7 +51,8 @@ typedef struct _MuIndexStats MuIndexStats;
|
|||
*
|
||||
* @return a new MuIndex instance, or NULL in case of error
|
||||
*/
|
||||
MuIndex* mu_index_new (const char* muhome, GError **err);
|
||||
MuIndex* mu_index_new (const char* muhome, GError **err)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
#ifndef __MU_MSG_ITER_H__
|
||||
#define __MU_MSG_ITER_H__
|
||||
|
||||
#include "mu-msg.h"
|
||||
#include <glib.h>
|
||||
#include <mu-msg.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -73,7 +74,8 @@ void mu_msg_iter_destroy (MuMsgIter *iter);
|
|||
* @return a MuMsgGMime instance, or NULL in case of error. Use
|
||||
* mu_msg_gmime_destroy when the instance is no longer needed
|
||||
*/
|
||||
MuMsg* mu_msg_iter_get_msg (MuMsgIter *iter, GError **err);
|
||||
MuMsg* mu_msg_iter_get_msg (MuMsgIter *iter, GError **err)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* get the document id for the current message
|
||||
|
|
|
@ -63,10 +63,8 @@ void mu_msg_gmime_uninit (void);
|
|||
*
|
||||
* @return a new MuMsg instance or NULL in case of error
|
||||
*/
|
||||
MuMsg* mu_msg_new (const char* filepath,
|
||||
const char *maildir,
|
||||
GError **err);
|
||||
|
||||
MuMsg *mu_msg_new (const char* filepath, const char *maildir,
|
||||
GError **err) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* destroy a MuMsg* instance; call this function when done with
|
||||
|
@ -126,8 +124,7 @@ const char* mu_msg_get_summary (MuMsg *msg, size_t max_lines);
|
|||
*
|
||||
* @return TRUE if saving succeeded, FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
mu_msg_mime_part_save (MuMsg *msg, unsigned wanted_idx,
|
||||
gboolean mu_msg_mime_part_save (MuMsg *msg, unsigned wanted_idx,
|
||||
const char *targetdir, gboolean overwrite);
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,8 @@ typedef struct _MuQuery MuQuery;
|
|||
* when the instance is no longer needed, use mu_query_destroy
|
||||
* to free it
|
||||
*/
|
||||
MuQuery *mu_query_new (const char* path, GError **err) G_GNUC_WARN_UNUSED_RESULT;
|
||||
MuQuery *mu_query_new (const char* path, GError **err)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* destroy the MuQuery instance
|
||||
|
@ -59,7 +60,8 @@ void mu_query_destroy (MuQuery *self);
|
|||
*
|
||||
* @return the version string (free with g_free), or NULL in case of error
|
||||
*/
|
||||
char* mu_query_version (MuQuery *store) G_GNUC_WARN_UNUSED_RESULT;
|
||||
char* mu_query_version (MuQuery *store)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* run a Xapian query; for the syntax, please refer to the mu-find
|
||||
|
@ -82,12 +84,10 @@ char* mu_query_version (MuQuery *store) G_GNUC_WARN_UNUSED_RESULT;
|
|||
* @return a MuMsgIter instance you can iterate over, or NULL in
|
||||
* case of error
|
||||
*/
|
||||
MuMsgIter* mu_query_run (MuQuery *self,
|
||||
const char* expr,
|
||||
MuMsgFieldId sortfieldid,
|
||||
gboolean ascending,
|
||||
size_t batchsize,
|
||||
GError **err) G_GNUC_WARN_UNUSED_RESULT;
|
||||
MuMsgIter* mu_query_run (MuQuery *self, const char* expr,
|
||||
MuMsgFieldId sortfieldid, gboolean ascending,
|
||||
size_t batchsize, GError **err)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* get a string representation of the Xapian search query
|
||||
|
@ -100,8 +100,8 @@ MuMsgIter* mu_query_run (MuQuery *self,
|
|||
* @return the string representation of the xapian query, or NULL in case of
|
||||
* error; free the returned value with g_free
|
||||
*/
|
||||
char* mu_query_as_string (MuQuery *self,
|
||||
const char* searchexpr, GError **err) G_GNUC_WARN_UNUSED_RESULT;
|
||||
char* mu_query_as_string (MuQuery *self, const char* searchexpr, GError **err)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* pre-process the query; this function is useful mainly for debugging mu
|
||||
|
@ -110,8 +110,8 @@ char* mu_query_as_string (MuQuery *self,
|
|||
*
|
||||
* @return a pre-processed query, free it with g_free
|
||||
*/
|
||||
char* mu_query_preprocess (const char *query) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
char* mu_query_preprocess (const char *query)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
15
src/mu-str.h
15
src/mu-str.h
|
@ -115,8 +115,8 @@ char* mu_str_size (size_t s) G_GNUC_WARN_UNUSED_RESULT;
|
|||
* for what to do with it
|
||||
*/
|
||||
const char* mu_str_flags_s (MuMsgFlags flags) G_GNUC_CONST;
|
||||
char* mu_str_flags (MuMsgFlags flags) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
char* mu_str_flags (MuMsgFlags flags)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* get a 'summary' of the string, ie. the first /n/ lines of the
|
||||
|
@ -127,10 +127,8 @@ char* mu_str_flags (MuMsgFlags flags) G_GNUC_WARN_UNUSED_RESULT;
|
|||
*
|
||||
* @return a newly allocated string with the summary. use g_free to free it.
|
||||
*/
|
||||
char* mu_str_summarize (const char* str,
|
||||
size_t max_lines) G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
char* mu_str_summarize (const char* str, size_t max_lines)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* normalize a string (ie., collapse accented characters etc.), and
|
||||
|
@ -142,7 +140,9 @@ char* mu_str_summarize (const char* str,
|
|||
*
|
||||
* @return the normalize string, or NULL in case of error or str was NULL
|
||||
*/
|
||||
char* mu_str_normalize (const char *str, gboolean downcase);
|
||||
char* mu_str_normalize (const char *str, gboolean downcase)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -159,7 +159,6 @@ char* mu_str_normalize (const char *str, gboolean downcase);
|
|||
*/
|
||||
char* mu_str_normalize_in_place (char *str, gboolean downcase);
|
||||
|
||||
|
||||
/**
|
||||
* escape the string for use with xapian matching. in practice, if the
|
||||
* string contains an '@', replace '@', single-'.' with '_'. Also,
|
||||
|
|
|
@ -40,7 +40,8 @@ gboolean mu_util_init_system (void);
|
|||
* @return the expanded path as a newly allocated string, or NULL in
|
||||
* case of error
|
||||
*/
|
||||
char* mu_util_dir_expand (const char* path) G_GNUC_WARN_UNUSED_RESULT;
|
||||
char* mu_util_dir_expand (const char* path)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* guess the maildir; first try $MAILDIR; if it is unset or
|
||||
|
@ -48,7 +49,8 @@ char* mu_util_dir_expand (const char* path) G_GNUC_WARN_UNUSED_RESULT;
|
|||
*
|
||||
* @return full path of the guessed Maildir, or NULL; must be freed (gfree)
|
||||
*/
|
||||
char* mu_util_guess_maildir (void) G_GNUC_WARN_UNUSED_RESULT;
|
||||
char* mu_util_guess_maildir (void)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -59,7 +61,8 @@ char* mu_util_guess_maildir (void) G_GNUC_WARN_UNUSED_RESULT;
|
|||
* @return the guessed mu homedir, which needs to be freed with g_free
|
||||
* when no longer needed.
|
||||
*/
|
||||
gchar* mu_util_guess_mu_homedir (void);
|
||||
gchar* mu_util_guess_mu_homedir (void)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* if path exists, check that's a read/writeable dir; otherwise try to
|
||||
|
@ -70,7 +73,8 @@ gchar* mu_util_guess_mu_homedir (void);
|
|||
* @return TRUE if a read/writeable directory `path' exists after
|
||||
* leaving this function, FALSE otherwise
|
||||
*/
|
||||
gboolean mu_util_create_dir_maybe (const gchar *path) G_GNUC_WARN_UNUSED_RESULT;
|
||||
gboolean mu_util_create_dir_maybe (const gchar *path)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -84,7 +88,8 @@ gboolean mu_util_create_dir_maybe (const gchar *path) G_GNUC_WARN_UNUSED_RESULT;
|
|||
* @return TRUE if dir exist and has the specified properties
|
||||
*/
|
||||
gboolean mu_util_check_dir (const gchar* path, gboolean readable,
|
||||
gboolean writeable) G_GNUC_WARN_UNUSED_RESULT;
|
||||
gboolean writeable)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
|
||||
|
||||
|
@ -97,11 +102,12 @@ gboolean mu_util_check_dir (const gchar* path, gboolean readable,
|
|||
* @param overwrite should we allow for overwriting existing files?
|
||||
*
|
||||
* @return a file descriptor, or -1 in case of error. If it's a fily
|
||||
* system error, 'errno' may have more info.
|
||||
* system error, 'errno' may have more info. use 'close()' when done
|
||||
* with the file descriptor
|
||||
*/
|
||||
int mu_util_create_writeable_fd (const char* filename, const char* dir,
|
||||
gboolean overwrite);
|
||||
|
||||
gboolean overwrite)
|
||||
G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* convert a string array in to a string, with the elements separated
|
||||
|
@ -111,7 +117,8 @@ int mu_util_create_writeable_fd (const char* filename, const char* dir,
|
|||
*
|
||||
* @return a newly allocated string
|
||||
*/
|
||||
gchar* mu_util_str_from_strv (const gchar **params) G_GNUC_WARN_UNUSED_RESULT;
|
||||
gchar* mu_util_str_from_strv (const gchar **params)
|
||||
G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue