[tracker/compilation-warnings: 6/13] libtracker-data: use g_atomic_int_add() if GLib >= 2.30
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/compilation-warnings: 6/13] libtracker-data: use g_atomic_int_add() if GLib >= 2.30
- Date: Fri, 16 Dec 2011 12:44:16 +0000 (UTC)
commit 92554b425ce0fb05c9560d1e4a865ee11b9644c5
Author: Aleksander Morgado <aleksander lanedo com>
Date: Fri Dec 16 11:56:03 2011 +0100
libtracker-data: use g_atomic_int_add() if GLib >= 2.30
Since 2.30, g_atomic_int_add() returns a gint and is fully equivalent to
g_atomic_int_exchange_and_add().
src/libtracker-data/tracker-db-interface-sqlite.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c b/src/libtracker-data/tracker-db-interface-sqlite.c
index 5c2b2a4..c16edc1 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -52,6 +52,13 @@
#include "tracker-db-interface-sqlite.h"
#include "tracker-db-manager.h"
+/* Since 2.30, g_atomic_int_add() is fully equivalente to g_atomic_int_exchange_and_add() */
+#if GLIB_CHECK_VERSION (2,30,0)
+#define ATOMIC_EXCHANGE_AND_ADD(a,v) g_atomic_int_add (a,v)
+#else
+#define ATOMIC_EXCHANGE_AND_ADD(a,v) g_atomic_int_exchange_and_add (a,v)
+#endif
+
#define UNKNOWN_STATUS 0.5
typedef struct {
@@ -1355,7 +1362,7 @@ execute_stmt (TrackerDBInterface *interface,
/* Statement is going to start, check if we got a request to reset the
* collator, and if so, do it. */
- if (g_atomic_int_exchange_and_add (&interface->n_active_cursors, 1) == 0 &&
+ if (ATOMIC_EXCHANGE_AND_ADD (&interface->n_active_cursors, 1) == 0 &&
g_atomic_int_compare_and_exchange (&(interface->collator_reset_requested), TRUE, FALSE)) {
tracker_db_interface_sqlite_reset_collator (interface);
}
@@ -1732,7 +1739,7 @@ tracker_db_cursor_sqlite_new (sqlite3_stmt *sqlite_stmt,
/* As soon as we create a cursor, check if we need a collator reset
* and notify the iface about the new cursor */
iface = ref_stmt->db_interface;
- if (g_atomic_int_exchange_and_add (&iface->n_active_cursors, 1) == 0 &&
+ if (ATOMIC_EXCHANGE_AND_ADD (&iface->n_active_cursors, 1) == 0 &&
g_atomic_int_compare_and_exchange (&(iface->collator_reset_requested), TRUE, FALSE)) {
tracker_db_interface_sqlite_reset_collator (iface);
}
@@ -2116,4 +2123,3 @@ tracker_db_statement_sqlite_reset (TrackerDBStatement *stmt)
sqlite3_reset (stmt->stmt);
sqlite3_clear_bindings (stmt->stmt);
}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]