[tracker: 22/25] libtracker-sparql: Fixed some coding style and whitespace issues
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker: 22/25] libtracker-sparql: Fixed some coding style and whitespace issues
- Date: Thu, 14 Oct 2010 17:02:38 +0000 (UTC)
commit 1798d43798d1a1bd4a3693e88fd9a75b2e188c58
Author: Martyn Russell <martyn lanedo com>
Date: Thu Oct 14 17:41:32 2010 +0100
libtracker-sparql: Fixed some coding style and whitespace issues
src/libtracker-bus/tracker-bus-fd-update.c | 667 +++++++++++---------
src/libtracker-sparql/tracker-connection.vala | 4 +-
src/tracker-store/tracker-steroids.c | 7 +-
.../update-array-performance-test.c | 120 +++-
tests/tracker-steroids/tracker-test.c | 27 +-
5 files changed, 469 insertions(+), 356 deletions(-)
---
diff --git a/src/libtracker-bus/tracker-bus-fd-update.c b/src/libtracker-bus/tracker-bus-fd-update.c
index a05f97d..76cc8e7 100644
--- a/src/libtracker-bus/tracker-bus-fd-update.c
+++ b/src/libtracker-bus/tracker-bus-fd-update.c
@@ -52,7 +52,6 @@ typedef struct {
gulong cancelid;
} FastAsyncData;
-
static void
fast_async_data_free (gpointer data)
{
@@ -89,7 +88,6 @@ on_cancel_idle (gpointer data)
"Operation was cancelled");
g_simple_async_result_set_from_error (fad->res, error);
-
g_simple_async_result_complete (fad->res);
g_error_free (error);
@@ -123,11 +121,15 @@ fast_async_data_new (DBusConnection *connection,
data->connection = dbus_connection_ref (connection);
data->operation_type = operation_type;
+
if (cancellable) {
data->cancellable = g_object_ref (cancellable);
-
- data->cancelid = g_cancellable_connect (cancellable, G_CALLBACK (on_cancel), data, NULL);
+ data->cancelid = g_cancellable_connect (cancellable,
+ G_CALLBACK (on_cancel),
+ data,
+ NULL);
}
+
data->user_data = user_data;
return data;
@@ -165,13 +167,9 @@ sparql_update_fast_callback (DBusPendingCall *call,
error = sparql_error_from_dbus_message (reply);
g_simple_async_result_set_from_error (fad->res, error);
-
dbus_message_unref (reply);
-
g_simple_async_result_complete (fad->res);
-
fast_async_data_free (fad);
-
dbus_pending_call_unref (call);
return;
@@ -262,14 +260,15 @@ sparql_update_array_fast_callback (DBusPendingCall *call,
dbus_message_iter_get_basic (&subiter, &message);
dbus_message_iter_next (&subiter);
- if (code && code[0] != '\0' && message && message[0] != '\0')
+ if (code && code[0] != '\0' && message && message[0] != '\0') {
error = g_error_new_literal (TRACKER_SPARQL_ERROR, 0, message);
- else
+ } else {
error = NULL;
+ }
+
g_ptr_array_add (errors, error);
}
-
g_simple_async_result_set_op_res_gpointer (fad->res,
g_ptr_array_ref (errors),
(GDestroyNotify) g_ptr_array_unref);
@@ -284,9 +283,7 @@ sparql_update_array_fast_callback (DBusPendingCall *call,
/* Clean up */
dbus_message_unref (reply);
-
fast_async_data_free (fad);
-
dbus_pending_call_unref (call);
}
@@ -360,242 +357,295 @@ sparql_update_fast_send (DBusConnection *connection,
g_propagate_error (error, inner_error);
g_object_unref (data_output_stream);
g_object_unref (buffered_output_stream);
- g_object_unref (output_stream);
- return NULL;
- }
-
- g_data_output_stream_put_string (data_output_stream,
- query,
- NULL,
- &inner_error);
-
- if (inner_error) {
- g_propagate_error (error, inner_error);
- g_object_unref (data_output_stream);
- g_object_unref (buffered_output_stream);
- g_object_unref (output_stream);
- return NULL;
- }
-
- g_object_unref (data_output_stream);
- g_object_unref (buffered_output_stream);
- g_object_unref (output_stream);
-
- return call;
-}
-
-
-static DBusPendingCall *
-sparql_update_array_fast_send (DBusConnection *connection,
- const gchar **queries,
- guint queries_len,
- FastOperationType type,
- GError **error)
-{
- const gchar *dbus_method;
- DBusMessage *message;
- DBusMessageIter iter;
- DBusPendingCall *call;
- int pipefd[2], i;
- GOutputStream *output_stream;
- GOutputStream *buffered_output_stream;
- GDataOutputStream *data_output_stream;
- GError *inner_error = NULL;
-
- g_return_val_if_fail (queries != NULL, NULL);
- g_return_val_if_fail (queries_len != 0, NULL);
-
- if (pipe (pipefd) < 0) {
- g_set_error (error,
- TRACKER_SPARQL_ERROR,
- TRACKER_SPARQL_ERROR_UNSUPPORTED,
- "Cannot open pipe");
- return NULL;
- }
-
- switch (type) {
- case FAST_UPDATE:
- dbus_method = "UpdateArray";
- break;
- case FAST_UPDATE_BATCH:
- dbus_method = "BatchUpdateArray";
- break;
- default:
- g_assert_not_reached ();
- }
-
- message = dbus_message_new_method_call (TRACKER_DBUS_SERVICE,
- TRACKER_DBUS_OBJECT_STEROIDS,
- TRACKER_DBUS_INTERFACE_STEROIDS,
- dbus_method);
- dbus_message_iter_init_append (message, &iter);
- dbus_message_iter_append_basic (&iter, DBUS_TYPE_UNIX_FD, &pipefd[0]);
- dbus_connection_send_with_reply (connection, message, &call, -1);
- dbus_message_unref (message);
- close (pipefd[0]);
-
- if (!call) {
- g_set_error (error,
- TRACKER_SPARQL_ERROR,
- TRACKER_SPARQL_ERROR_UNSUPPORTED,
- "FD passing unsupported or connection disconnected");
- return NULL;
- }
-
- output_stream = g_unix_output_stream_new (pipefd[1], TRUE);
- buffered_output_stream = g_buffered_output_stream_new_sized (output_stream,
- TRACKER_DBUS_PIPE_BUFFER_SIZE);
- data_output_stream = g_data_output_stream_new (buffered_output_stream);
-
- g_data_output_stream_put_uint32 (data_output_stream,
- queries_len,
- NULL,
- &inner_error);
-
- for (i = 0; i < queries_len; i++) {
- const gchar *query = queries[i];
-
- g_data_output_stream_put_int32 (data_output_stream, strlen (query),
- NULL, &inner_error);
-
- if (inner_error) {
- g_propagate_error (error, inner_error);
- g_object_unref (data_output_stream);
- g_object_unref (buffered_output_stream);
- g_object_unref (output_stream);
- return NULL;
- }
-
- g_data_output_stream_put_string (data_output_stream,
- query,
- NULL,
+ g_object_unref (output_stream);
+
+ return NULL;
+ }
+
+ g_data_output_stream_put_string (data_output_stream,
+ query,
+ NULL,
+ &inner_error);
+
+ if (inner_error) {
+ g_propagate_error (error, inner_error);
+ g_object_unref (data_output_stream);
+ g_object_unref (buffered_output_stream);
+ g_object_unref (output_stream);
+ return NULL;
+ }
+
+ g_object_unref (data_output_stream);
+ g_object_unref (buffered_output_stream);
+ g_object_unref (output_stream);
+
+ return call;
+ }
+
+ static DBusPendingCall *
+ sparql_update_array_fast_send (DBusConnection *connection,
+ const gchar **queries,
+ guint queries_len,
+ FastOperationType type,
+ GError **error)
+ {
+ const gchar *dbus_method;
+ DBusMessage *message;
+ DBusMessageIter iter;
+ DBusPendingCall *call;
+ int pipefd[2], i;
+ GOutputStream *output_stream;
+ GOutputStream *buffered_output_stream;
+ GDataOutputStream *data_output_stream;
+ GError *inner_error = NULL;
+
+ g_return_val_if_fail (queries != NULL, NULL);
+ g_return_val_if_fail (queries_len != 0, NULL);
+
+ if (pipe (pipefd) < 0) {
+ g_set_error (error,
+ TRACKER_SPARQL_ERROR,
+ TRACKER_SPARQL_ERROR_UNSUPPORTED,
+ "Cannot open pipe");
+ return NULL;
+ }
+
+ switch (type) {
+ case FAST_UPDATE:
+ dbus_method = "UpdateArray";
+ break;
+ case FAST_UPDATE_BATCH:
+ dbus_method = "BatchUpdateArray";
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ message = dbus_message_new_method_call (TRACKER_DBUS_SERVICE,
+ TRACKER_DBUS_OBJECT_STEROIDS,
+ TRACKER_DBUS_INTERFACE_STEROIDS,
+ dbus_method);
+ dbus_message_iter_init_append (message, &iter);
+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_UNIX_FD, &pipefd[0]);
+ dbus_connection_send_with_reply (connection, message, &call, -1);
+ dbus_message_unref (message);
+ close (pipefd[0]);
+
+ if (!call) {
+ g_set_error (error,
+ TRACKER_SPARQL_ERROR,
+ TRACKER_SPARQL_ERROR_UNSUPPORTED,
+ "FD passing unsupported or connection disconnected");
+ return NULL;
+ }
+
+ output_stream = g_unix_output_stream_new (pipefd[1], TRUE);
+ buffered_output_stream = g_buffered_output_stream_new_sized (output_stream,
+ TRACKER_DBUS_PIPE_BUFFER_SIZE);
+ data_output_stream = g_data_output_stream_new (buffered_output_stream);
+
+ g_data_output_stream_put_uint32 (data_output_stream,
+ queries_len,
+ NULL,
+ &inner_error);
+
+ for (i = 0; i < queries_len; i++) {
+ const gchar *query = queries[i];
+
+ g_data_output_stream_put_int32 (data_output_stream,
+ strlen (query),
+ NULL,
&inner_error);
- if (inner_error) {
- g_propagate_error (error, inner_error);
- g_object_unref (data_output_stream);
- g_object_unref (buffered_output_stream);
- g_object_unref (output_stream);
- return NULL;
- }
- }
-
- g_object_unref (data_output_stream);
- g_object_unref (buffered_output_stream);
- g_object_unref (output_stream);
-
- return call;
-}
-
-static DBusMessage *
-sparql_update_fast (DBusConnection *connection,
- const gchar *query,
- FastOperationType type,
- GError **error)
-{
- DBusPendingCall *call;
- DBusMessage *reply;
-
- call = sparql_update_fast_send (connection, query, type, error);
- if (!call) {
- return NULL;
- }
-
- dbus_pending_call_block (call);
-
- reply = dbus_pending_call_steal_reply (call);
-
- if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR) {
- g_propagate_error (error, sparql_error_from_dbus_message (reply));
-
- return NULL;
- }
-
- dbus_pending_call_unref (call);
-
- return reply;
-}
-
-static void
-sparql_update_fast_async (DBusConnection *connection,
- const gchar *query,
- FastAsyncData *fad,
- GError **error)
-{
- DBusPendingCall *call;
-
- call = sparql_update_fast_send (connection, query, fad->operation_type, error);
- if (!call) {
- /* Do some clean up ?*/
- return;
- }
-
- fad->dbus_call = call;
-
- dbus_pending_call_set_notify (call, sparql_update_fast_callback, fad, NULL);
-}
-
-static void
-sparql_update_array_fast_async (DBusConnection *connection,
- const gchar **queries,
- guint queries_len,
- FastAsyncData *fad,
- GError **error)
-{
- DBusPendingCall *call;
-
- call = sparql_update_array_fast_send (connection, queries, queries_len, fad->operation_type, error);
- if (!call) {
- /* Do some clean up ?*/
- return;
- }
-
- fad->dbus_call = call;
-
- dbus_pending_call_set_notify (call, sparql_update_array_fast_callback, fad, NULL);
-}
-
-/* Public API */
-
-void
-tracker_bus_fd_sparql_update (DBusGConnection *connection,
- const char *query,
- GError **error)
-{
- DBusMessage *reply;
-
- g_return_if_fail (query != NULL);
-
- reply = sparql_update_fast (dbus_g_connection_get_connection (connection),
- query, FAST_UPDATE, error);
-
- if (!reply) {
- return;
- }
-
- dbus_message_unref (reply);
-}
-
-void
-tracker_bus_fd_sparql_update_async (DBusGConnection *connection,
- const char *query,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- FastAsyncData *fad;
- GError *error = NULL;
-
- g_return_if_fail (query != NULL);
-
- fad = fast_async_data_new (dbus_g_connection_get_connection (connection),
- FAST_UPDATE, cancellable, user_data);
-
- fad->res = g_simple_async_result_new (NULL, callback, user_data,
- tracker_bus_fd_sparql_update_async);
-
- sparql_update_fast_async (dbus_g_connection_get_connection (connection),
- query, fad, &error);
+ if (inner_error) {
+ g_propagate_error (error, inner_error);
+ g_object_unref (data_output_stream);
+ g_object_unref (buffered_output_stream);
+ g_object_unref (output_stream);
+ return NULL;
+ }
+
+ g_data_output_stream_put_string (data_output_stream,
+ query,
+ NULL,
+ &inner_error);
+
+ if (inner_error) {
+ g_propagate_error (error, inner_error);
+ g_object_unref (data_output_stream);
+ g_object_unref (buffered_output_stream);
+ g_object_unref (output_stream);
+ return NULL;
+ }
+ }
+
+ g_object_unref (data_output_stream);
+ g_object_unref (buffered_output_stream);
+ g_object_unref (output_stream);
+
+ return call;
+ }
+
+ static DBusMessage *
+ sparql_update_fast (DBusConnection *connection,
+ const gchar *query,
+ FastOperationType type,
+ GError **error)
+ {
+ DBusPendingCall *call;
+ DBusMessage *reply;
+
+ call = sparql_update_fast_send (connection, query, type, error);
+ if (!call) {
+ return NULL;
+ }
+
+ dbus_pending_call_block (call);
+
+ reply = dbus_pending_call_steal_reply (call);
+
+ if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR) {
+ g_propagate_error (error, sparql_error_from_dbus_message (reply));
+
+ return NULL;
+ }
+
+ dbus_pending_call_unref (call);
+
+ return reply;
+ }
+
+ static void
+ sparql_update_fast_async (DBusConnection *connection,
+ const gchar *query,
+ FastAsyncData *fad,
+ GError **error)
+ {
+ DBusPendingCall *call;
+
+ call = sparql_update_fast_send (connection, query, fad->operation_type, error);
+ if (!call) {
+ /* Do some clean up ?*/
+ return;
+ }
+
+ fad->dbus_call = call;
+
+ dbus_pending_call_set_notify (call, sparql_update_fast_callback, fad, NULL);
+ }
+
+ static void
+ sparql_update_array_fast_async (DBusConnection *connection,
+ const gchar **queries,
+ guint queries_len,
+ FastAsyncData *fad,
+ GError **error)
+ {
+ DBusPendingCall *call;
+
+ call = sparql_update_array_fast_send (connection,
+ queries,
+ queries_len,
+ fad->operation_type,
+ error);
+
+ if (!call) {
+ /* Do some clean up ?*/
+ return;
+ }
+
+ fad->dbus_call = call;
+
+ dbus_pending_call_set_notify (call, sparql_update_array_fast_callback, fad, NULL);
+ }
+
+ /* Public API */
+
+ void
+ tracker_bus_fd_sparql_update (DBusGConnection *connection,
+ const char *query,
+ GError **error)
+ {
+ DBusMessage *reply;
+
+ g_return_if_fail (query != NULL);
+
+ reply = sparql_update_fast (dbus_g_connection_get_connection (connection),
+ query,
+ FAST_UPDATE,
+ error);
+
+ if (!reply) {
+ return;
+ }
+
+ dbus_message_unref (reply);
+ }
+
+ void
+ tracker_bus_fd_sparql_update_async (DBusGConnection *connection,
+ const char *query,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+ {
+ FastAsyncData *fad;
+ GError *error = NULL;
+
+ g_return_if_fail (query != NULL);
+
+ fad = fast_async_data_new (dbus_g_connection_get_connection (connection),
+ FAST_UPDATE,
+ cancellable,
+ user_data);
+
+ fad->res = g_simple_async_result_new (NULL,
+ callback,
+ user_data,
+ tracker_bus_fd_sparql_update_async);
+
+ sparql_update_fast_async (dbus_g_connection_get_connection (connection),
+ query,
+ fad,
+ &error);
+
+ if (error) {
+ g_critical ("Could not initiate update: %s", error->message);
+ g_error_free (error);
+ g_object_unref (fad->res);
+ fast_async_data_free (fad);
+ }
+ }
+
+ void
+ tracker_bus_fd_sparql_update_array_async (DBusGConnection *connection,
+ const char **queries,
+ guint queries_len,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+ {
+ FastAsyncData *fad;
+ GError *error = NULL;
+
+ g_return_if_fail (queries != NULL);
+ g_return_if_fail (queries_len != 0);
+
+ fad = fast_async_data_new (dbus_g_connection_get_connection (connection),
+ FAST_UPDATE,
+ cancellable,
+ user_data);
+
+ fad->res = g_simple_async_result_new (NULL,
+ callback,
+ user_data,
+ tracker_bus_fd_sparql_update_async);
+
+ sparql_update_array_fast_async (dbus_g_connection_get_connection (connection),
+ queries,
+ queries_len,
+ fad,
+ &error);
if (error) {
g_critical ("Could not initiate update: %s", error->message);
@@ -606,57 +656,32 @@ tracker_bus_fd_sparql_update_async (DBusGConnection *connection,
}
void
-tracker_bus_fd_sparql_update_array_async (DBusGConnection *connection,
- const char **queries,
- guint queries_len,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- FastAsyncData *fad;
- GError *error = NULL;
-
- g_return_if_fail (queries != NULL);
- g_return_if_fail (queries_len != 0);
-
- fad = fast_async_data_new (dbus_g_connection_get_connection (connection),
- FAST_UPDATE, cancellable, user_data);
-
- fad->res = g_simple_async_result_new (NULL, callback, user_data,
- tracker_bus_fd_sparql_update_async);
-
- sparql_update_array_fast_async (dbus_g_connection_get_connection (connection),
- queries, queries_len, fad, &error);
-
- if (error) {
- g_critical ("Could not initiate update: %s", error->message);
- g_error_free (error);
- g_object_unref (fad->res);
- fast_async_data_free (fad);
- }
-}
-
-void
-tracker_bus_fd_sparql_update_finish (GAsyncResult *res,
- GError **error)
+tracker_bus_fd_sparql_update_finish (GAsyncResult *res,
+ GError **error)
{
g_return_if_fail (res != NULL);
g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
}
-
GVariant *
-tracker_bus_fd_sparql_update_blank_finish (GAsyncResult *res,
- GError **error)
+tracker_bus_fd_sparql_update_blank_finish (GAsyncResult *res,
+ GError **error)
{
+ GSimpleAsyncResult *simple_res;
+ gpointer p;
+
g_return_val_if_fail (res != NULL, NULL);
- if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) {
+ simple_res = G_SIMPLE_ASYNC_RESULT (res);
+
+ if (g_simple_async_result_propagate_error (simple_res, error)) {
return NULL;
}
- return g_variant_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
+ p = g_simple_async_result_get_op_res_gpointer (simple_res);
+
+ return g_variant_ref (p);
}
GVariant *
@@ -670,7 +695,9 @@ tracker_bus_fd_sparql_update_blank (DBusGConnection *connection,
g_return_val_if_fail (query != NULL, NULL);
reply = sparql_update_fast (dbus_g_connection_get_connection (connection),
- query, FAST_UPDATE_BLANK, error);
+ query,
+ FAST_UPDATE_BLANK,
+ error);
if (!reply) {
return NULL;
@@ -692,11 +719,11 @@ tracker_bus_fd_sparql_update_blank (DBusGConnection *connection,
}
void
-tracker_bus_fd_sparql_update_blank_async (DBusGConnection *connection,
- const gchar *query,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+tracker_bus_fd_sparql_update_blank_async (DBusGConnection *connection,
+ const gchar *query,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
FastAsyncData *fad;
GError *error = NULL;
@@ -709,11 +736,15 @@ tracker_bus_fd_sparql_update_blank_async (DBusGConnection *connection,
cancellable,
user_data);
- fad->res = g_simple_async_result_new (NULL, callback, user_data,
+ fad->res = g_simple_async_result_new (NULL,
+ callback,
+ user_data,
tracker_bus_fd_sparql_update_blank_async);
sparql_update_fast_async (dbus_g_connection_get_connection (connection),
- query, fad, &error);
+ query,
+ fad,
+ &error);
if (error) {
g_critical ("Could not initiate update: %s", error->message);
@@ -733,7 +764,9 @@ tracker_bus_fd_sparql_batch_update (DBusGConnection *connection,
g_return_if_fail (query != NULL);
reply = sparql_update_fast (dbus_g_connection_get_connection (connection),
- query, FAST_UPDATE_BATCH, error);
+ query,
+ FAST_UPDATE_BATCH,
+ error);
if (!reply) {
return;
@@ -771,14 +804,13 @@ tracker_bus_fd_sparql_batch_update_async (DBusGConnection *connection,
}
}
-
void
-tracker_bus_fd_sparql_batch_update_array_async (DBusGConnection *connection,
- const char **queries,
- guint queries_len,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
+tracker_bus_fd_sparql_batch_update_array_async (DBusGConnection *connection,
+ const char **queries,
+ guint queries_len,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
{
FastAsyncData *fad;
GError *error = NULL;
@@ -787,13 +819,20 @@ tracker_bus_fd_sparql_batch_update_array_async (DBusGConnection *connecti
g_return_if_fail (queries_len != 0);
fad = fast_async_data_new (dbus_g_connection_get_connection (connection),
- FAST_UPDATE_BATCH, cancellable, user_data);
+ FAST_UPDATE_BATCH,
+ cancellable,
+ user_data);
- fad->res = g_simple_async_result_new (NULL, callback, user_data,
+ fad->res = g_simple_async_result_new (NULL,
+ callback,
+ user_data,
tracker_bus_fd_sparql_batch_update_async);
sparql_update_array_fast_async (dbus_g_connection_get_connection (connection),
- queries, queries_len, fad, &error);
+ queries,
+ queries_len,
+ fad,
+ &error);
if (error) {
g_critical ("Could not initiate update: %s", error->message);
@@ -804,26 +843,34 @@ tracker_bus_fd_sparql_batch_update_array_async (DBusGConnection *connecti
}
void
-tracker_bus_fd_sparql_batch_update_finish (GAsyncResult *res,
- GError **error)
+tracker_bus_fd_sparql_batch_update_finish (GAsyncResult *res,
+ GError **error)
{
g_return_if_fail (res != NULL);
g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
}
-GPtrArray*
+GPtrArray *
tracker_bus_fd_sparql_update_array_finish (GAsyncResult *res)
{
+ gpointer p;
+
g_return_val_if_fail (res != NULL, NULL);
- return g_ptr_array_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
+ p = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res));
+
+ return g_ptr_array_ref (p);
}
-GPtrArray*
+GPtrArray *
tracker_bus_fd_sparql_batch_update_array_finish (GAsyncResult *res)
{
+ gpointer p;
+
g_return_val_if_fail (res != NULL, NULL);
- return g_ptr_array_ref (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
+ p = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res));
+
+ return g_ptr_array_ref (p);
}
diff --git a/src/libtracker-sparql/tracker-connection.vala b/src/libtracker-sparql/tracker-connection.vala
index 03db982..024714b 100644
--- a/src/libtracker-sparql/tracker-connection.vala
+++ b/src/libtracker-sparql/tracker-connection.vala
@@ -451,7 +451,7 @@ public abstract class Tracker.Sparql.Connection : Object {
* @error: #GError for error reporting.
*
* Finishes the asynchronous SPARQL update_array operation.
- *
+ *
* <example>
* <programlisting>
* static void
@@ -471,7 +471,7 @@ public abstract class Tracker.Sparql.Connection : Object {
* }
* </programlisting>
* </example>
- *
+ *
* Returns: a #GPtrArray of size @sparql_length1 with elements that are
* either NULL or a GError instance. The returned array should be freed with
* g_ptr_array_unref when no longer used, not with g_ptr_array_free. When
diff --git a/src/tracker-store/tracker-steroids.c b/src/tracker-store/tracker-steroids.c
index 33c7163..4b5e8d1 100644
--- a/src/tracker-store/tracker-steroids.c
+++ b/src/tracker-store/tracker-steroids.c
@@ -186,8 +186,9 @@ update_array_callback (GError *error, gpointer user_data)
info->array_info.seen++;
- if (!info->array_info.errors)
+ if (!info->array_info.errors) {
info->array_info.errors = g_ptr_array_new ();
+ }
if (error) {
g_ptr_array_add (info->array_info.errors, g_error_copy (error));
@@ -218,9 +219,11 @@ update_array_callback (GError *error, gpointer user_data)
dbus_message_iter_append_basic (&subiter, DBUS_TYPE_STRING, &str);
dbus_message_iter_append_basic (&subiter, DBUS_TYPE_STRING, &message);
- if (error)
+ if (error) {
g_error_free (error);
+ }
}
+
g_ptr_array_free (info->array_info.errors, TRUE);
dbus_message_iter_close_container (&iter, &subiter);
diff --git a/tests/functional-tests/update-array-performance-test.c b/tests/functional-tests/update-array-performance-test.c
index 52c4415..bfdfa2c 100644
--- a/tests/functional-tests/update-array-performance-test.c
+++ b/tests/functional-tests/update-array-performance-test.c
@@ -36,36 +36,96 @@ static TrackerSparqlConnection *connection;
#define TEST_STR "Brrr0092323"
static const gchar *queries[90] = {
- "INSERT { _:a0 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:a9 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:a11 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:b0 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:b9 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:b11 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:c0 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:c9 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:c12 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:d0 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:d9 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:d12 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:e0 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:e9 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:e11 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:f0 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:f9 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:f11 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:b1 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:b8 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:b13 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:c1 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:c8 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:c13 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:d1 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:d8 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:d14 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:e1 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:e8 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:e14 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:f1 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:f8 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:f15 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:b2 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:b7 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:b15 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:c2 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:c7 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:c15 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:d2 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:d7 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:d16 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:e2 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:e7 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:e16 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:f2 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:f7 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:f17 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:b3 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:b6 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:b16 a nmo:Message; nie:title '" TEST_STR "'}",
- "INSERT { _:c3 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:c6 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:c18 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:d3 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:d6 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:d19 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:e3 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:e6 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:e20 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:f3 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:f6 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:f21 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:b4 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:b5 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:b22 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:c4 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:c5 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:c23 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:d4 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:d5 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:d24 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:e4 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:e5 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:e24 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:f4 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:f5 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:f25 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:c5 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:c2 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:c26 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:d5 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:d2 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:d28 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:e5 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:e2 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:e29 a nmo:Message; nie:title '" TEST_STR "' }",
- "INSERT { _:f5 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:f2 a nmo:Message; nie:title '" TEST_STR "' }", "INSERT { _:f33 a nmo:Message; nie:title '" TEST_STR "' }"};
+ "INSERT { _:a0 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:a9 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:a11 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:b0 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:b9 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:b11 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c0 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c9 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c12 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d0 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d9 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d12 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e0 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e9 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e11 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f0 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f9 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f11 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:b1 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:b8 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:b13 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c1 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c8 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c13 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d1 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d8 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d14 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e1 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e8 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e14 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f1 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f8 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f15 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:b2 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:b7 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:b15 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c2 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c7 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c15 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d2 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d7 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d16 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e2 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e7 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e16 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f2 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f7 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f17 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:b3 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:b6 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:b16 a nmo:Message; nie:title '" TEST_STR "'}",
+ "INSERT { _:c3 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c6 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c18 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d3 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d6 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d19 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e3 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e6 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e20 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f3 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f6 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f21 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:b4 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:b5 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:b22 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c4 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c5 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c23 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d4 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d5 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d24 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e4 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e5 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e24 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f4 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f5 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f25 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c5 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c2 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:c26 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d5 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d2 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:d28 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e5 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e2 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:e29 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f5 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f2 a nmo:Message; nie:title '" TEST_STR "' }",
+ "INSERT { _:f33 a nmo:Message; nie:title '" TEST_STR "' }" };
static void
async_update_array_callback (GObject *source_object,
diff --git a/tests/tracker-steroids/tracker-test.c b/tests/tracker-steroids/tracker-test.c
index eb57fad..2285d8a 100644
--- a/tests/tracker-steroids/tracker-test.c
+++ b/tests/tracker-steroids/tracker-test.c
@@ -324,7 +324,7 @@ async_update_array_callback (GObject *source_object,
static void
-test_tracker_sparql_update_array_async ()
+test_tracker_sparql_update_array_async (void)
{
const gchar *queries[6] = { "INSERT { _:a a nmo:Message }",
"INSERT { _:b a nmo:Message }",
@@ -343,8 +343,10 @@ test_tracker_sparql_update_array_async ()
/* Cast here is because vala doesn't make const-char-** possible :( */
tracker_sparql_connection_update_array_async (connection,
- (char**) queries, 6,
- 0, NULL,
+ (char**) queries,
+ 6,
+ 0,
+ NULL,
async_update_array_callback,
data);
@@ -408,7 +410,7 @@ test_tracker_sparql_update_blank_fast_large ()
}
static void
-test_tracker_sparql_update_blank_fast_error ()
+test_tracker_sparql_update_blank_fast_error (void)
{
GError *error = NULL;
const gchar *query = "blork blork blork";
@@ -423,7 +425,7 @@ test_tracker_sparql_update_blank_fast_error ()
}
static void
-test_tracker_sparql_update_blank_fast_no_blanks ()
+test_tracker_sparql_update_blank_fast_no_blanks (void)
{
GError *error = NULL;
const gchar *query = "INSERT { <urn:not_blank> a nmo:Message }";
@@ -438,7 +440,7 @@ test_tracker_sparql_update_blank_fast_no_blanks ()
}
static void
-test_tracker_batch_sparql_update_fast ()
+test_tracker_batch_sparql_update_fast (void)
{
/* GError *error = NULL; */
/* const gchar *query = "INSERT { _:x a nmo:Message }"; */
@@ -473,7 +475,8 @@ async_query_cb (GObject *source_object,
g_assert_no_error (error);
g_assert (cursor_glib != NULL);
- while (tracker_sparql_cursor_next (cursor_fd, NULL, NULL) && tracker_sparql_cursor_next (cursor_glib, NULL, NULL)) {
+ while (tracker_sparql_cursor_next (cursor_fd, NULL, NULL) &&
+ tracker_sparql_cursor_next (cursor_glib, NULL, NULL)) {
g_assert_cmpstr (tracker_sparql_cursor_get_string (cursor_fd, 0, NULL),
==,
tracker_sparql_cursor_get_string (cursor_glib, 0, NULL));
@@ -487,7 +490,7 @@ async_query_cb (GObject *source_object,
}
static void
-test_tracker_sparql_query_iterate_async ()
+test_tracker_sparql_query_iterate_async (void)
{
const gchar *query = "SELECT ?r nie:url(?r) WHERE {?r a nfo:FileDataObject}";
GMainLoop *main_loop;
@@ -528,7 +531,7 @@ cancel_query_cb (GObject *source_object,
}
static void
-test_tracker_sparql_query_iterate_async_cancel ()
+test_tracker_sparql_query_iterate_async_cancel (void)
{
const gchar *query = "SELECT ?r nie:url(?r) WHERE {?r a nfo:FileDataObject}";
GMainLoop *main_loop;
@@ -565,7 +568,7 @@ async_update_callback (GObject *source_object,
}
static void
-test_tracker_sparql_update_async ()
+test_tracker_sparql_update_async (void)
{
const gchar *query = "INSERT { _:x a nmo:Message }";
GMainLoop *main_loop;
@@ -606,7 +609,7 @@ cancel_update_cb (GObject *source_object,
}
static void
-test_tracker_sparql_update_async_cancel ()
+test_tracker_sparql_update_async_cancel (void)
{
GCancellable *cancellable = g_cancellable_new ();
const gchar *query = "INSERT { _:x a nmo:Message }";
@@ -645,7 +648,7 @@ async_update_blank_callback (GObject *source_object,
}
static void
-test_tracker_sparql_update_blank_async ()
+test_tracker_sparql_update_blank_async (void)
{
const gchar *query = "INSERT { _:x a nmo:Message }";
GMainLoop *main_loop;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]