*.cc: remove _-prefixed functions (violates ISO-C)

This commit is contained in:
Dirk-Jan C. Binnema 2010-01-15 22:15:09 +02:00
parent da1e9a3841
commit 5fd98d2e2e
3 changed files with 39 additions and 39 deletions

View File

@ -77,7 +77,7 @@ mu_msg_xapian_destroy (MuMsgXapian *msg)
} }
static gboolean static gboolean
_message_is_readable (MuMsgXapian *msg) message_is_readable (MuMsgXapian *msg)
{ {
Xapian::Document doc (msg->_cursor.get_document()); Xapian::Document doc (msg->_cursor.get_document());
const std::string path(doc.get_value(MU_MSG_FIELD_ID_PATH)); 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 * these messages from the db, but that would might screw
* up the search; also, we only have read-only access to the * up the search; also, we only have read-only access to the
* db here */ * db here */
if (!_message_is_readable (msg)) if (!message_is_readable (msg))
return mu_msg_xapian_next (msg); return mu_msg_xapian_next (msg);
for (int i = 0; i != MU_MSG_FIELD_ID_NUM; ++i) { 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* 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)); return mu_msg_xapian_get_field(row, mu_msg_field_from_id (id));
} }
static long 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; return str ? atol (str) : 0;
} }
@ -204,59 +204,59 @@ mu_msg_xapian_get_docid (MuMsgXapian *row)
const char* const char*
mu_msg_xapian_get_path (MuMsgXapian *row) 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* const char*
mu_msg_xapian_get_from (MuMsgXapian *row) 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* const char*
mu_msg_xapian_get_to (MuMsgXapian *row) 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* const char*
mu_msg_xapian_get_cc (MuMsgXapian *row) 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* const char*
mu_msg_xapian_get_subject (MuMsgXapian *row) 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 size_t
mu_msg_xapian_get_size (MuMsgXapian *row) 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 time_t
mu_msg_xapian_get_date (MuMsgXapian *row) 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 MuMsgFlags
mu_msg_xapian_get_flags (MuMsgXapian *row) 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 MuMsgPriority
mu_msg_xapian_get_priority (MuMsgXapian *row) 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);
} }

View File

@ -40,7 +40,7 @@ struct _MuQueryXapian {
}; };
gboolean gboolean
_init_mu_query_xapian (MuQueryXapian *mqx, const char* dbpath) init_mu_query_xapian (MuQueryXapian *mqx, const char* dbpath)
{ {
mqx->_db = 0; mqx->_db = 0;
mqx->_qparser = 0; mqx->_qparser = 0;
@ -72,7 +72,7 @@ _init_mu_query_xapian (MuQueryXapian *mqx, const char* dbpath)
static void static void
_uninit_mu_query_xapian (MuQueryXapian *mqx) uninit_mu_query_xapian (MuQueryXapian *mqx)
{ {
try { try {
delete mqx->_db; delete mqx->_db;
@ -85,7 +85,7 @@ _uninit_mu_query_xapian (MuQueryXapian *mqx)
} }
static Xapian::Query static Xapian::Query
_get_query (MuQueryXapian * mqx, const char* searchexpr, int *err = 0) { get_query (MuQueryXapian * mqx, const char* searchexpr, int *err = 0) {
try { try {
return mqx->_qparser->parse_query return mqx->_qparser->parse_query
@ -138,7 +138,7 @@ mu_query_xapian_new (const char* xpath)
mqx = g_new (MuQueryXapian, 1); 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_warning ("failed to initalize xapian query");
g_free (mqx); g_free (mqx);
return NULL; return NULL;
@ -154,7 +154,7 @@ mu_query_xapian_destroy (MuQueryXapian *self)
if (!self) if (!self)
return; return;
_uninit_mu_query_xapian (self); uninit_mu_query_xapian (self);
g_free (self); g_free (self);
} }
@ -167,7 +167,7 @@ mu_query_xapian_run (MuQueryXapian *self, const char* searchexpr,
g_return_val_if_fail (searchexpr, NULL); g_return_val_if_fail (searchexpr, NULL);
try { try {
Xapian::Query q(_get_query(self, searchexpr)); Xapian::Query q(get_query(self, searchexpr));
Xapian::Enquire enq (*self->_db); Xapian::Enquire enq (*self->_db);
if (sortfield) if (sortfield)
@ -190,7 +190,7 @@ mu_query_xapian_as_string (MuQueryXapian *self, const char* searchexpr)
g_return_val_if_fail (searchexpr, NULL); g_return_val_if_fail (searchexpr, NULL);
try { try {
Xapian::Query q(_get_query(self, searchexpr)); Xapian::Query q(get_query(self, searchexpr));
return g_strdup(q.get_description().c_str()); return g_strdup(q.get_description().c_str());
} MU_XAPIAN_CATCH_BLOCK_RETURN(NULL); } MU_XAPIAN_CATCH_BLOCK_RETURN(NULL);
@ -198,7 +198,7 @@ mu_query_xapian_as_string (MuQueryXapian *self, const char* searchexpr)
static gboolean static gboolean
_needs_quotes (const char* str) needs_quotes (const char* str)
{ {
int i; int i;
const char *keywords[] = { const char *keywords[] = {
@ -236,7 +236,7 @@ mu_query_xapian_combine (const gchar **params, gboolean connect_or)
if (params[i + 1]) if (params[i + 1])
cnx = connect_or ? " OR " : " AND "; cnx = connect_or ? " OR " : " AND ";
do_quote = _needs_quotes (elm); do_quote = needs_quotes (elm);
g_string_append_printf (str, "%s%s%s%s", g_string_append_printf (str, "%s%s%s%s",
do_quote ? "\"" : "", do_quote ? "\"" : "",
elm, elm,

View File

@ -74,7 +74,7 @@ mu_store_xapian_new (const char* xpath)
static void static void
_begin_transaction_if (MuStoreXapian *store, gboolean cond) begin_transaction_if (MuStoreXapian *store, gboolean cond)
{ {
if (cond) { if (cond) {
g_debug ("beginning Xapian transaction"); g_debug ("beginning Xapian transaction");
@ -84,7 +84,7 @@ _begin_transaction_if (MuStoreXapian *store, gboolean cond)
} }
static void static void
_commit_transaction_if (MuStoreXapian *store, gboolean cond) commit_transaction_if (MuStoreXapian *store, gboolean cond)
{ {
if (cond) { if (cond) {
g_debug ("comitting Xapian transaction"); g_debug ("comitting Xapian transaction");
@ -94,7 +94,7 @@ _commit_transaction_if (MuStoreXapian *store, gboolean cond)
} }
static void static void
_rollback_transaction_if (MuStoreXapian *store, gboolean cond) rollback_transaction_if (MuStoreXapian *store, gboolean cond)
{ {
if (cond) { if (cond) {
g_debug ("rolling back Xapian transaction"); g_debug ("rolling back Xapian transaction");
@ -128,7 +128,7 @@ mu_store_xapian_flush (MuStoreXapian *store)
g_return_if_fail (store); g_return_if_fail (store);
try { try {
_commit_transaction_if (store, store->_in_transaction); commit_transaction_if (store, store->_in_transaction);
store->_db->flush (); store->_db->flush ();
} MU_XAPIAN_CATCH_BLOCK; } MU_XAPIAN_CATCH_BLOCK;
@ -232,7 +232,7 @@ add_terms_values (const MuMsgField* field, MsgDoc* msgdoc)
/* get a unique id for this message */ /* get a unique id for this message */
static std::string static std::string
_get_message_uid (const char* path) get_message_uid (const char* path)
{ {
static const MuMsgField* pathfield = static const MuMsgField* pathfield =
mu_msg_field_from_id(MU_MSG_FIELD_ID_PATH); mu_msg_field_from_id(MU_MSG_FIELD_ID_PATH);
@ -243,9 +243,9 @@ _get_message_uid (const char* path)
} }
static std::string 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::Document newdoc;
Xapian::docid id; Xapian::docid id;
MsgDoc msgdoc = { &newdoc, msg }; 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 /* we must add a unique term, so we can replace matching
* documents */ * documents */
newdoc.add_term (uid); newdoc.add_term (uid);
@ -272,14 +272,14 @@ mu_store_xapian_store (MuStoreXapian *store, MuMsgGMime *msg)
/* we replace all existing documents for this file */ /* we replace all existing documents for this file */
id = store->_db->replace_document (uid, newdoc); id = store->_db->replace_document (uid, newdoc);
++store->_processed; ++store->_processed;
_commit_transaction_if (store, commit_transaction_if (store,
store->_processed % store->_trx_size == 0); store->_processed % store->_trx_size == 0);
return MU_OK; return MU_OK;
} MU_XAPIAN_CATCH_BLOCK; } MU_XAPIAN_CATCH_BLOCK;
_rollback_transaction_if (store, store->_in_transaction); rollback_transaction_if (store, store->_in_transaction);
return MU_ERROR; return MU_ERROR;
} }
@ -292,9 +292,9 @@ mu_store_xapian_remove (MuStoreXapian *store, const char* msgpath)
g_return_val_if_fail (msgpath, MU_ERROR); g_return_val_if_fail (msgpath, MU_ERROR);
try { 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); store->_db->delete_document (uid);
g_debug ("deleting %s", msgpath); g_debug ("deleting %s", msgpath);
@ -303,7 +303,7 @@ mu_store_xapian_remove (MuStoreXapian *store, const char* msgpath)
/* do we need to commit now? */ /* do we need to commit now? */
bool commit_now = store->_processed % store->_trx_size == 0; bool commit_now = store->_processed % store->_trx_size == 0;
_commit_transaction_if (store, commit_now); commit_transaction_if (store, commit_now);
return MU_OK; return MU_OK;
@ -318,7 +318,7 @@ mu_store_contains_message (MuStoreXapian *store, const char* path)
g_return_val_if_fail (path, NULL); g_return_val_if_fail (path, NULL);
try { 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; return store->_db->term_exists (uid) ? TRUE: FALSE;
} MU_XAPIAN_CATCH_BLOCK_RETURN (FALSE); } MU_XAPIAN_CATCH_BLOCK_RETURN (FALSE);