mirror of https://github.com/djcb/mu.git
*.cc: remove _-prefixed functions (violates ISO-C)
This commit is contained in:
parent
da1e9a3841
commit
5fd98d2e2e
|
@ -77,7 +77,7 @@ mu_msg_xapian_destroy (MuMsgXapian *msg)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_message_is_readable (MuMsgXapian *msg)
|
||||
message_is_readable (MuMsgXapian *msg)
|
||||
{
|
||||
Xapian::Document doc (msg->_cursor.get_document());
|
||||
const std::string path(doc.get_value(MU_MSG_FIELD_ID_PATH));
|
||||
|
@ -109,7 +109,7 @@ mu_msg_xapian_next (MuMsgXapian *msg)
|
|||
* these messages from the db, but that would might screw
|
||||
* up the search; also, we only have read-only access to the
|
||||
* db here */
|
||||
if (!_message_is_readable (msg))
|
||||
if (!message_is_readable (msg))
|
||||
return mu_msg_xapian_next (msg);
|
||||
|
||||
for (int i = 0; i != MU_MSG_FIELD_ID_NUM; ++i) {
|
||||
|
@ -174,15 +174,15 @@ mu_msg_xapian_get_field_numeric (MuMsgXapian *row, const MuMsgField *field)
|
|||
|
||||
|
||||
static const gchar*
|
||||
_get_field (MuMsgXapian *row, MuMsgFieldId id)
|
||||
get_field (MuMsgXapian *row, MuMsgFieldId id)
|
||||
{
|
||||
return mu_msg_xapian_get_field(row, mu_msg_field_from_id (id));
|
||||
}
|
||||
|
||||
static long
|
||||
_get_field_number (MuMsgXapian *row, MuMsgFieldId id)
|
||||
get_field_number (MuMsgXapian *row, MuMsgFieldId id)
|
||||
{
|
||||
const char* str = _get_field (row, id);
|
||||
const char* str = get_field (row, id);
|
||||
return str ? atol (str) : 0;
|
||||
}
|
||||
|
||||
|
@ -204,59 +204,59 @@ mu_msg_xapian_get_docid (MuMsgXapian *row)
|
|||
const char*
|
||||
mu_msg_xapian_get_path (MuMsgXapian *row)
|
||||
{
|
||||
return _get_field (row, MU_MSG_FIELD_ID_PATH);
|
||||
return get_field (row, MU_MSG_FIELD_ID_PATH);
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
mu_msg_xapian_get_from (MuMsgXapian *row)
|
||||
{
|
||||
return _get_field (row, MU_MSG_FIELD_ID_FROM);
|
||||
return get_field (row, MU_MSG_FIELD_ID_FROM);
|
||||
}
|
||||
|
||||
const char*
|
||||
mu_msg_xapian_get_to (MuMsgXapian *row)
|
||||
{
|
||||
return _get_field (row, MU_MSG_FIELD_ID_TO);
|
||||
return get_field (row, MU_MSG_FIELD_ID_TO);
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
mu_msg_xapian_get_cc (MuMsgXapian *row)
|
||||
{
|
||||
return _get_field (row, MU_MSG_FIELD_ID_CC);
|
||||
return get_field (row, MU_MSG_FIELD_ID_CC);
|
||||
}
|
||||
|
||||
|
||||
const char*
|
||||
mu_msg_xapian_get_subject (MuMsgXapian *row)
|
||||
{
|
||||
return _get_field (row, MU_MSG_FIELD_ID_SUBJECT);
|
||||
return get_field (row, MU_MSG_FIELD_ID_SUBJECT);
|
||||
}
|
||||
|
||||
|
||||
size_t
|
||||
mu_msg_xapian_get_size (MuMsgXapian *row)
|
||||
{
|
||||
return (size_t) _get_field_number (row, MU_MSG_FIELD_ID_SIZE);
|
||||
return (size_t) get_field_number (row, MU_MSG_FIELD_ID_SIZE);
|
||||
}
|
||||
|
||||
|
||||
time_t
|
||||
mu_msg_xapian_get_date (MuMsgXapian *row)
|
||||
{
|
||||
return (size_t) _get_field_number (row, MU_MSG_FIELD_ID_DATE);
|
||||
return (size_t) get_field_number (row, MU_MSG_FIELD_ID_DATE);
|
||||
}
|
||||
|
||||
|
||||
MuMsgFlags
|
||||
mu_msg_xapian_get_flags (MuMsgXapian *row)
|
||||
{
|
||||
return (MuMsgFlags) _get_field_number (row, MU_MSG_FIELD_ID_FLAGS);
|
||||
return (MuMsgFlags) get_field_number (row, MU_MSG_FIELD_ID_FLAGS);
|
||||
}
|
||||
|
||||
MuMsgPriority
|
||||
mu_msg_xapian_get_priority (MuMsgXapian *row)
|
||||
{
|
||||
return (MuMsgPriority) _get_field_number (row, MU_MSG_FIELD_ID_PRIORITY);
|
||||
return (MuMsgPriority) get_field_number (row, MU_MSG_FIELD_ID_PRIORITY);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ struct _MuQueryXapian {
|
|||
};
|
||||
|
||||
gboolean
|
||||
_init_mu_query_xapian (MuQueryXapian *mqx, const char* dbpath)
|
||||
init_mu_query_xapian (MuQueryXapian *mqx, const char* dbpath)
|
||||
{
|
||||
mqx->_db = 0;
|
||||
mqx->_qparser = 0;
|
||||
|
@ -72,7 +72,7 @@ _init_mu_query_xapian (MuQueryXapian *mqx, const char* dbpath)
|
|||
|
||||
|
||||
static void
|
||||
_uninit_mu_query_xapian (MuQueryXapian *mqx)
|
||||
uninit_mu_query_xapian (MuQueryXapian *mqx)
|
||||
{
|
||||
try {
|
||||
delete mqx->_db;
|
||||
|
@ -85,7 +85,7 @@ _uninit_mu_query_xapian (MuQueryXapian *mqx)
|
|||
}
|
||||
|
||||
static Xapian::Query
|
||||
_get_query (MuQueryXapian * mqx, const char* searchexpr, int *err = 0) {
|
||||
get_query (MuQueryXapian * mqx, const char* searchexpr, int *err = 0) {
|
||||
|
||||
try {
|
||||
return mqx->_qparser->parse_query
|
||||
|
@ -138,7 +138,7 @@ mu_query_xapian_new (const char* xpath)
|
|||
|
||||
mqx = g_new (MuQueryXapian, 1);
|
||||
|
||||
if (!_init_mu_query_xapian (mqx, xpath)) {
|
||||
if (!init_mu_query_xapian (mqx, xpath)) {
|
||||
g_warning ("failed to initalize xapian query");
|
||||
g_free (mqx);
|
||||
return NULL;
|
||||
|
@ -154,7 +154,7 @@ mu_query_xapian_destroy (MuQueryXapian *self)
|
|||
if (!self)
|
||||
return;
|
||||
|
||||
_uninit_mu_query_xapian (self);
|
||||
uninit_mu_query_xapian (self);
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ mu_query_xapian_run (MuQueryXapian *self, const char* searchexpr,
|
|||
g_return_val_if_fail (searchexpr, NULL);
|
||||
|
||||
try {
|
||||
Xapian::Query q(_get_query(self, searchexpr));
|
||||
Xapian::Query q(get_query(self, searchexpr));
|
||||
Xapian::Enquire enq (*self->_db);
|
||||
|
||||
if (sortfield)
|
||||
|
@ -190,7 +190,7 @@ mu_query_xapian_as_string (MuQueryXapian *self, const char* searchexpr)
|
|||
g_return_val_if_fail (searchexpr, NULL);
|
||||
|
||||
try {
|
||||
Xapian::Query q(_get_query(self, searchexpr));
|
||||
Xapian::Query q(get_query(self, searchexpr));
|
||||
return g_strdup(q.get_description().c_str());
|
||||
|
||||
} MU_XAPIAN_CATCH_BLOCK_RETURN(NULL);
|
||||
|
@ -198,7 +198,7 @@ mu_query_xapian_as_string (MuQueryXapian *self, const char* searchexpr)
|
|||
|
||||
|
||||
static gboolean
|
||||
_needs_quotes (const char* str)
|
||||
needs_quotes (const char* str)
|
||||
{
|
||||
int i;
|
||||
const char *keywords[] = {
|
||||
|
@ -236,7 +236,7 @@ mu_query_xapian_combine (const gchar **params, gboolean connect_or)
|
|||
if (params[i + 1])
|
||||
cnx = connect_or ? " OR " : " AND ";
|
||||
|
||||
do_quote = _needs_quotes (elm);
|
||||
do_quote = needs_quotes (elm);
|
||||
g_string_append_printf (str, "%s%s%s%s",
|
||||
do_quote ? "\"" : "",
|
||||
elm,
|
||||
|
|
|
@ -74,7 +74,7 @@ mu_store_xapian_new (const char* xpath)
|
|||
|
||||
|
||||
static void
|
||||
_begin_transaction_if (MuStoreXapian *store, gboolean cond)
|
||||
begin_transaction_if (MuStoreXapian *store, gboolean cond)
|
||||
{
|
||||
if (cond) {
|
||||
g_debug ("beginning Xapian transaction");
|
||||
|
@ -84,7 +84,7 @@ _begin_transaction_if (MuStoreXapian *store, gboolean cond)
|
|||
}
|
||||
|
||||
static void
|
||||
_commit_transaction_if (MuStoreXapian *store, gboolean cond)
|
||||
commit_transaction_if (MuStoreXapian *store, gboolean cond)
|
||||
{
|
||||
if (cond) {
|
||||
g_debug ("comitting Xapian transaction");
|
||||
|
@ -94,7 +94,7 @@ _commit_transaction_if (MuStoreXapian *store, gboolean cond)
|
|||
}
|
||||
|
||||
static void
|
||||
_rollback_transaction_if (MuStoreXapian *store, gboolean cond)
|
||||
rollback_transaction_if (MuStoreXapian *store, gboolean cond)
|
||||
{
|
||||
if (cond) {
|
||||
g_debug ("rolling back Xapian transaction");
|
||||
|
@ -128,7 +128,7 @@ mu_store_xapian_flush (MuStoreXapian *store)
|
|||
g_return_if_fail (store);
|
||||
|
||||
try {
|
||||
_commit_transaction_if (store, store->_in_transaction);
|
||||
commit_transaction_if (store, store->_in_transaction);
|
||||
store->_db->flush ();
|
||||
|
||||
} MU_XAPIAN_CATCH_BLOCK;
|
||||
|
@ -232,7 +232,7 @@ add_terms_values (const MuMsgField* field, MsgDoc* msgdoc)
|
|||
|
||||
/* get a unique id for this message */
|
||||
static std::string
|
||||
_get_message_uid (const char* path)
|
||||
get_message_uid (const char* path)
|
||||
{
|
||||
static const MuMsgField* pathfield =
|
||||
mu_msg_field_from_id(MU_MSG_FIELD_ID_PATH);
|
||||
|
@ -243,9 +243,9 @@ _get_message_uid (const char* path)
|
|||
}
|
||||
|
||||
static std::string
|
||||
_get_message_uid (MuMsgGMime *msg)
|
||||
get_message_uid (MuMsgGMime *msg)
|
||||
{
|
||||
return _get_message_uid (mu_msg_gmime_get_path(msg));
|
||||
return get_message_uid (mu_msg_gmime_get_path(msg));
|
||||
}
|
||||
|
||||
|
||||
|
@ -260,9 +260,9 @@ mu_store_xapian_store (MuStoreXapian *store, MuMsgGMime *msg)
|
|||
Xapian::Document newdoc;
|
||||
Xapian::docid id;
|
||||
MsgDoc msgdoc = { &newdoc, msg };
|
||||
const std::string uid(_get_message_uid(msg));
|
||||
const std::string uid(get_message_uid(msg));
|
||||
|
||||
_begin_transaction_if (store, !store->_in_transaction);
|
||||
begin_transaction_if (store, !store->_in_transaction);
|
||||
/* we must add a unique term, so we can replace matching
|
||||
* documents */
|
||||
newdoc.add_term (uid);
|
||||
|
@ -272,14 +272,14 @@ mu_store_xapian_store (MuStoreXapian *store, MuMsgGMime *msg)
|
|||
/* we replace all existing documents for this file */
|
||||
id = store->_db->replace_document (uid, newdoc);
|
||||
++store->_processed;
|
||||
_commit_transaction_if (store,
|
||||
store->_processed % store->_trx_size == 0);
|
||||
commit_transaction_if (store,
|
||||
store->_processed % store->_trx_size == 0);
|
||||
|
||||
return MU_OK;
|
||||
|
||||
} MU_XAPIAN_CATCH_BLOCK;
|
||||
|
||||
_rollback_transaction_if (store, store->_in_transaction);
|
||||
rollback_transaction_if (store, store->_in_transaction);
|
||||
|
||||
return MU_ERROR;
|
||||
}
|
||||
|
@ -292,9 +292,9 @@ mu_store_xapian_remove (MuStoreXapian *store, const char* msgpath)
|
|||
g_return_val_if_fail (msgpath, MU_ERROR);
|
||||
|
||||
try {
|
||||
const std::string uid (_get_message_uid (msgpath));
|
||||
const std::string uid (get_message_uid (msgpath));
|
||||
|
||||
_begin_transaction_if (store, !store->_in_transaction);
|
||||
begin_transaction_if (store, !store->_in_transaction);
|
||||
|
||||
store->_db->delete_document (uid);
|
||||
g_debug ("deleting %s", msgpath);
|
||||
|
@ -303,7 +303,7 @@ mu_store_xapian_remove (MuStoreXapian *store, const char* msgpath)
|
|||
|
||||
/* do we need to commit now? */
|
||||
bool commit_now = store->_processed % store->_trx_size == 0;
|
||||
_commit_transaction_if (store, commit_now);
|
||||
commit_transaction_if (store, commit_now);
|
||||
|
||||
return MU_OK;
|
||||
|
||||
|
@ -318,7 +318,7 @@ mu_store_contains_message (MuStoreXapian *store, const char* path)
|
|||
g_return_val_if_fail (path, NULL);
|
||||
|
||||
try {
|
||||
const std::string uid (_get_message_uid(path));
|
||||
const std::string uid (get_message_uid(path));
|
||||
return store->_db->term_exists (uid) ? TRUE: FALSE;
|
||||
|
||||
} MU_XAPIAN_CATCH_BLOCK_RETURN (FALSE);
|
||||
|
|
Loading…
Reference in New Issue