#include <glib.h>
#include <gio/gio.h>
#include <dlog.h>
+#include <sqlite3.h>
#include "rua.h"
#include "rua_dbus.h"
#define RUA_PATH "/org/tizen/rua"
#define RUA_SIGNAL_DATA_UPDATE "dataupdate"
-struct cb_data
-{
+struct cb_data {
int callback_id;
rua_history_update_cb callback;
void *user_data;
static guint s_id;
static gint atomic_callback_id;
-static GHashTable* callback_hash_table;
+static GHashTable *callback_hash_table;
static void __foreach_callback(gpointer key, gpointer value,
gpointer user_data);
RUA_SIGNAL_DATA_UPDATE,
g_variant_new("(i)", type),
&err) == FALSE) {
- LOGE("g_dbus_connection_emit_signal() is failed. %s",
- err->message);
+ if (err != NULL) {
+ LOGE("g_dbus_connection_emit_signal() is failed. %s",
+ err->message);
+ g_clear_error(&err);
+ } else {
+ LOGE("g_dbus_connection_emit_signal() is failed");
+ }
__rua_dbus_exit();
return -1;
}
if (g_dbus_connection_flush_sync(conn, NULL, &err) == FALSE) {
- LOGE("g_dbus_connection_flush_sync() is failed. %s",
- err->message);
+ if (err != NULL) {
+ LOGE("g_dbus_connection_flush_sync() is failed. %s",
+ err->message);
+ g_clear_error(&err);
+ } else {
+ LOGE("g_dbus_connection_emit_signal() is failed");
+ }
__rua_dbus_exit();
return -1;
}
if (r == -1)
return;
- if (cd->callback) {
+ if (cd->callback)
cd->callback(table, nrows, ncols, cd->user_data);
- }
+
+ sqlite3_free_table(table);
}
static void __signal_handler(GDBusConnection *connection,
static void __rua_dbus_init(void)
{
- if (!conn) {
- GError *err = NULL;
- conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
- if (!conn) {
- LOGE("g_bus_get_sync() is failed. %s", err->message);
- g_error_free(err);
- return;
- }
+ GError *err = NULL;
+
+ if (conn)
+ return;
+
+ conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+ if (conn)
+ return;
+
+ if (err != NULL) {
+ LOGE("g_bus_get_sync() is failed. %s", err->message);
+ g_error_free(err);
+ } else {
+ LOGE("g_bus_get_sync() is failed.");
}
}