[tracker/tracker-0.10] libtracker-data: Do not compile journal functions with --disable-journal



commit 543e4b4348395f56be77112e7acbd31846825dcd
Author: JÃrg Billeter <j bitron ch>
Date:   Fri Jul 22 14:08:20 2011 +0200

    libtracker-data: Do not compile journal functions with --disable-journal
    
    This reduces difference to master. No functional change.

 src/libtracker-data/tracker-db-journal.c |  128 +++---------------------------
 1 files changed, 12 insertions(+), 116 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-journal.c b/src/libtracker-data/tracker-db-journal.c
index 7800624..a227025 100644
--- a/src/libtracker-data/tracker-db-journal.c
+++ b/src/libtracker-data/tracker-db-journal.c
@@ -43,6 +43,8 @@
 
 #include "tracker-db-journal.h"
 
+#ifndef DISABLE_JOURNAL
+
 #define MIN_BLOCK_SIZE    1024
 
 /*
@@ -447,10 +449,6 @@ db_journal_init_file (JournalWriter  *jwriter,
 	int flags;
 	int mode;
 
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	jwriter->cur_block_len = 0;
 	jwriter->cur_pos = 0;
 	jwriter->cur_entry_amount = 0;
@@ -526,10 +524,6 @@ db_journal_writer_init (JournalWriter  *jwriter,
 	GError *n_error = NULL;
 	gboolean ret;
 
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	directory = g_path_get_dirname (filename);
 	if (g_strcmp0 (directory, ".")) {
 		mode = S_IRWXU | S_IRWXG | S_IRWXO;
@@ -570,10 +564,6 @@ tracker_db_journal_init (const gchar  *filename,
 	gchar *filename_free = NULL;
 	GError *n_error = NULL;
 
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	g_return_val_if_fail (writer.journal == 0, FALSE);
 
 	if (filename == NULL) {
@@ -606,10 +596,6 @@ db_journal_ontology_init (GError **error)
 	gchar *filename;
 	GError *n_error = NULL;
 
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	g_return_val_if_fail (ontology_writer.journal == 0, FALSE);
 
 	filename = g_build_filename (g_get_user_data_dir (),
@@ -659,10 +645,6 @@ tracker_db_journal_shutdown (GError **error)
 	GError *n_error = NULL;
 	gboolean ret;
 
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	ret = db_journal_writer_shutdown (&writer, &n_error);
 
 	if (n_error) {
@@ -683,10 +665,6 @@ tracker_db_journal_get_size (void)
 const gchar *
 tracker_db_journal_get_filename (void)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	/* Journal doesn't have to be open to get the filename, for example when
 	 * the file didn't exist and it was attempted opened in only read mode. */
 	return (const gchar*) writer.journal_filename;
@@ -732,10 +710,6 @@ db_journal_writer_start_transaction (JournalWriter    *jwriter,
 gboolean
 tracker_db_journal_start_transaction (time_t time)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	return db_journal_writer_start_transaction (&writer, time,
 	                                            TRANSACTION_FORMAT_DATA);
 }
@@ -746,10 +720,6 @@ tracker_db_journal_start_ontology_transaction (time_t   time,
 {
 	GError *n_error = NULL;
 
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	if (!db_journal_ontology_init (&n_error)) {
 
 		if (n_error) {
@@ -811,10 +781,6 @@ tracker_db_journal_append_delete_statement (gint         g_id,
                                             gint         p_id,
                                             const gchar *object)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	if (current_transaction_format == TRANSACTION_FORMAT_ONTOLOGY) {
 		return TRUE;
 	}
@@ -869,10 +835,6 @@ tracker_db_journal_append_delete_statement_id (gint g_id,
                                                gint p_id,
                                                gint o_id)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	if (current_transaction_format == TRANSACTION_FORMAT_ONTOLOGY) {
 		return TRUE;
 	}
@@ -929,10 +891,6 @@ tracker_db_journal_append_insert_statement (gint         g_id,
                                             gint         p_id,
                                             const gchar *object)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	if (current_transaction_format == TRANSACTION_FORMAT_ONTOLOGY) {
 		return TRUE;
 	}
@@ -987,10 +945,6 @@ tracker_db_journal_append_insert_statement_id (gint g_id,
                                                gint p_id,
                                                gint o_id)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	if (current_transaction_format == TRANSACTION_FORMAT_ONTOLOGY) {
 		return TRUE;
 	}
@@ -1047,10 +1001,6 @@ tracker_db_journal_append_update_statement (gint         g_id,
                                             gint         p_id,
                                             const gchar *object)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	if (current_transaction_format == TRANSACTION_FORMAT_ONTOLOGY) {
 		return TRUE;
 	}
@@ -1105,10 +1055,6 @@ tracker_db_journal_append_update_statement_id (gint g_id,
                                                gint p_id,
                                                gint o_id)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	if (current_transaction_format == TRANSACTION_FORMAT_ONTOLOGY) {
 		return TRUE;
 	}
@@ -1150,10 +1096,6 @@ tracker_db_journal_append_resource (gint         s_id,
 {
 	gboolean ret;
 
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	g_return_val_if_fail (current_transaction_format != TRANSACTION_FORMAT_NONE, FALSE);
 
 	if (current_transaction_format == TRANSACTION_FORMAT_ONTOLOGY) {
@@ -1170,10 +1112,6 @@ tracker_db_journal_rollback_transaction (GError **error)
 {
 	GError *n_error = NULL;
 
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	g_return_val_if_fail (writer.journal > 0, FALSE);
 	g_return_val_if_fail (current_transaction_format != TRANSACTION_FORMAT_NONE, FALSE);
 
@@ -1196,10 +1134,6 @@ tracker_db_journal_rollback_transaction (GError **error)
 gboolean
 tracker_db_journal_truncate (gsize new_size)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	g_return_val_if_fail (writer.journal > 0, FALSE);
 
 	return (ftruncate (writer.journal, new_size) != -1);
@@ -1259,10 +1193,6 @@ tracker_db_journal_commit_db_transaction (GError **error)
 	gboolean ret;
 	GError *n_error = NULL;
 
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	g_return_val_if_fail (current_transaction_format != TRANSACTION_FORMAT_NONE, FALSE);
 
 	if (current_transaction_format == TRANSACTION_FORMAT_ONTOLOGY) {
@@ -1293,10 +1223,6 @@ tracker_db_journal_commit_db_transaction (GError **error)
 gboolean
 tracker_db_journal_fsync (void)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	g_return_val_if_fail (writer.journal > 0, FALSE);
 
 	return fsync (writer.journal) == 0;
@@ -1483,10 +1409,6 @@ tracker_db_journal_reader_init (const gchar  *filename,
 	gboolean ret;
 	GError *n_error = NULL;
 
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	ret = db_journal_reader_init (&reader, TRUE, filename, &n_error);
 
 	if (n_error) {
@@ -1504,10 +1426,6 @@ tracker_db_journal_reader_ontology_init (const gchar  *filename,
 	gboolean result;
 	GError *n_error = NULL;
 
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	/* Used mostly for testing */
 	if (G_UNLIKELY (filename)) {
 		filename_used = g_strdup (filename);
@@ -1533,10 +1451,6 @@ tracker_db_journal_reader_ontology_init (const gchar  *filename,
 gsize
 tracker_db_journal_reader_get_size_of_correct (void)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	g_return_val_if_fail (reader.file != NULL, FALSE);
 
 	return (gsize) (reader.last_success - reader.start);
@@ -1628,10 +1542,6 @@ db_journal_reader_shutdown (JournalReader *jreader)
 gboolean
 tracker_db_journal_reader_shutdown (void)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	return db_journal_reader_shutdown (&reader);
 }
 
@@ -1944,10 +1854,6 @@ db_journal_reader_next (JournalReader *jreader, gboolean global_reader, GError *
 gboolean
 tracker_db_journal_reader_next (GError **error)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	return db_journal_reader_next (&reader, TRUE, error);
 }
 
@@ -1960,10 +1866,6 @@ tracker_db_journal_reader_verify_last (const gchar  *filename,
 	JournalReader jreader = { 0 };
 	GError *n_error = NULL;
 
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	if (db_journal_reader_init (&jreader, FALSE, filename, &n_error)) {
 
 		if (jreader.end != jreader.current) {
@@ -2002,10 +1904,6 @@ gboolean
 tracker_db_journal_reader_get_resource (gint         *id,
                                         const gchar **uri)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	g_return_val_if_fail (reader.file != NULL || reader.stream != NULL, FALSE);
 	g_return_val_if_fail (reader.type == TRACKER_DB_JOURNAL_RESOURCE, FALSE);
 
@@ -2021,10 +1919,6 @@ tracker_db_journal_reader_get_statement (gint         *g_id,
                                          gint         *p_id,
                                          const gchar **object)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	g_return_val_if_fail (reader.file != NULL || reader.stream != NULL, FALSE);
 	g_return_val_if_fail (reader.type == TRACKER_DB_JOURNAL_INSERT_STATEMENT ||
 	                      reader.type == TRACKER_DB_JOURNAL_DELETE_STATEMENT ||
@@ -2047,10 +1941,6 @@ tracker_db_journal_reader_get_statement_id (gint *g_id,
                                             gint *p_id,
                                             gint *o_id)
 {
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	g_return_val_if_fail (reader.file != NULL || reader.stream != NULL, FALSE);
 	g_return_val_if_fail (reader.type == TRACKER_DB_JOURNAL_INSERT_STATEMENT_ID ||
 	                      reader.type == TRACKER_DB_JOURNAL_DELETE_STATEMENT_ID ||
@@ -2074,10 +1964,6 @@ tracker_db_journal_reader_get_progress (void)
 	guint current_file;
 	static guint total_chunks = 0;
 
-#ifdef DISABLE_JOURNAL
-	g_critical ("Journal is disabled, yet a journal function got called");
-#endif
-
 	current_file = reader.current_file == 0 ? total_chunks -1 : reader.current_file -1;
 
 	if (!rotating_settings.rotate_progress_flag) {
@@ -2289,3 +2175,13 @@ tracker_db_journal_rotate (GError **error)
 	return ret;
 }
 #endif /* GLib check */
+
+#else /* DISABLE_JOURNAL */
+void
+tracker_db_journal_set_rotating (gboolean     do_rotating,
+                                 gsize        chunk_size,
+                                 const gchar *rotate_to)
+{
+	/* intentionally left blank, used for internal API compatibility */
+}
+#endif /* DISABLE_JOURNAL */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]