summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorINSUN PYO <insun.pyo@samsung.com>2020-09-03 20:24:26 +0900
committerINSUN PYO <insun.pyo@samsung.com>2020-09-03 20:26:37 +0900
commit0ac2ff1c88b971aeb036937c30e18117cc8f530d (patch)
tree70a82ec583af6f5dcde3a841a99440ac4afb5106
parent6c87ef41968b7107eb1ca1f189bdc8567b79011e (diff)
downloadsession-utils-0ac2ff1c88b971aeb036937c30e18117cc8f530d.tar.gz
session-utils-0ac2ff1c88b971aeb036937c30e18117cc8f530d.tar.bz2
session-utils-0ac2ff1c88b971aeb036937c30e18117cc8f530d.zip
Change-Id: I0cab882eb9d23764e8a831da0739b2d06a3bc1e8
-rw-r--r--src/dbus-activation-stop-test/dbus-activation-stop-test.c16
-rw-r--r--src/dbus-send-receive-test/dbus-send-receive-test.c35
2 files changed, 26 insertions, 25 deletions
diff --git a/src/dbus-activation-stop-test/dbus-activation-stop-test.c b/src/dbus-activation-stop-test/dbus-activation-stop-test.c
index fe0036f..358ea1e 100644
--- a/src/dbus-activation-stop-test/dbus-activation-stop-test.c
+++ b/src/dbus-activation-stop-test/dbus-activation-stop-test.c
@@ -30,32 +30,32 @@ static GMainLoop *mainloop;
static void sig_term(int signo)
{
- fprintf (stderr, "sig term\n");
+ fprintf(stderr, "sig term\n");
}
static void sig_abort(int signo)
{
- fprintf (stderr, "sig abort\n");
+ fprintf(stderr, "sig abort\n");
sd_notify(0, "STOPPING=1");
- g_bus_unown_name (owner_id);
+ g_bus_unown_name(owner_id);
}
static void sig_quit(int signo)
{
- fprintf (stderr, "sig quit\n");
+ fprintf(stderr, "sig quit\n");
g_main_loop_quit(mainloop);
}
static void name_acquire(GDBusConnection *connection, const gchar *name, gpointer user_data)
{
- fprintf (stderr, "name acquire : %s\n", name);
+ fprintf(stderr, "name acquire : %s\n", name);
}
static void name_lost(GDBusConnection *connection, const gchar *name, gpointer user_data)
{
- fprintf (stderr, "name lost : %s\n", name);
+ fprintf(stderr, "name lost : %s\n", name);
}
int main(int argc, char *argv[])
@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
if (!conn || err) {
- fprintf (stderr, "failed to get system bus\n");
+ fprintf(stderr, "failed to get system bus\n");
return -1;
}
@@ -73,7 +73,7 @@ int main(int argc, char *argv[])
name_acquire, name_lost, NULL, NULL);
if (owner_id == 0) {
- fprintf (stderr, "g_bus_own_name_on_connection fails\n");
+ fprintf(stderr, "g_bus_own_name_on_connection fails\n");
return -1;
}
diff --git a/src/dbus-send-receive-test/dbus-send-receive-test.c b/src/dbus-send-receive-test/dbus-send-receive-test.c
index a679565..72a1d55 100644
--- a/src/dbus-send-receive-test/dbus-send-receive-test.c
+++ b/src/dbus-send-receive-test/dbus-send-receive-test.c
@@ -32,12 +32,12 @@
static void name_acquire(GDBusConnection *connection, const gchar *name, gpointer user_data)
{
- fprintf (stderr, "name acquire : %s\n", name);
+ fprintf(stderr, "name acquire : %s\n", name);
}
static void name_lost(GDBusConnection *connection, const gchar *name, gpointer user_data)
{
- fprintf (stderr, "name lost : %s\n", name);
+ fprintf(stderr, "name lost : %s\n", name);
}
static void method_call_handler (GDBusConnection *connection,
@@ -52,9 +52,9 @@ static void method_call_handler (GDBusConnection *connection,
gint input;
g_variant_get(parameters, "(i)", &input);
- printf ("%s:%d\n", method_name, input);
+ printf("%s:%d\n", method_name, input);
- g_dbus_method_invocation_return_value (invocation, g_variant_new("(i)", input));
+ g_dbus_method_invocation_return_value(invocation, g_variant_new("(i)", input));
}
static const GDBusInterfaceVTable vtable =
@@ -82,33 +82,33 @@ static int dbus_server()
conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
if (!conn || error) {
- fprintf (stderr, "failed to get system bus\n");
+ fprintf(stderr, "failed to get system bus\n");
return -1;
}
- introspection_data = g_dbus_node_info_new_for_xml (xml, NULL);
+ introspection_data = g_dbus_node_info_new_for_xml(xml, NULL);
if (!introspection_data) {
- fprintf (stderr, "g_dbus_node_info_new_for_xml fails\n");
+ fprintf(stderr, "g_dbus_node_info_new_for_xml fails\n");
return -1;
}
- registration_id = g_dbus_connection_register_object (conn, PATH, introspection_data->interfaces[0], &vtable, NULL, NULL, NULL);
+ registration_id = g_dbus_connection_register_object(conn, PATH, introspection_data->interfaces[0], &vtable, NULL, NULL, NULL);
if (registration_id == 0) {
- fprintf (stderr, "g_dbus_connection_register_object fails\n");
+ fprintf(stderr, "g_dbus_connection_register_object fails\n");
return -1;
}
owner_id = g_bus_own_name_on_connection(conn, "org.tizen.dbus-send-receive-test", G_BUS_NAME_OWNER_FLAGS_NONE, name_acquire, name_lost, NULL, NULL);
if (owner_id == 0) {
- fprintf (stderr, "g_bus_own_name_on_connection fails\n");
+ fprintf(stderr, "g_bus_own_name_on_connection fails\n");
return -1;
}
mainloop = g_main_loop_new(NULL, FALSE);
g_main_loop_run(mainloop);
- g_bus_unown_name (owner_id);
- g_dbus_node_info_unref (introspection_data);
+ g_bus_unown_name(owner_id);
+ g_dbus_node_info_unref(introspection_data);
g_main_loop_unref(mainloop);
return 0;
@@ -123,18 +123,19 @@ static int dbus_client()
conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
if (!conn || error) {
- fprintf (stderr, "failed to get system bus\n");
+ fprintf(stderr, "failed to get system bus\n");
return -1;
}
reply = g_dbus_connection_call_sync(conn, NAME, PATH, INTERFACE, METHOD, g_variant_new("(i)", 1), NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
if (!reply || error) {
- fprintf (stderr, "g_dbus_connection_call_sync fails\n");
+ fprintf(stderr, "g_dbus_connection_call_sync fails\n");
return -1;
}
- g_variant_get (reply, "(i)", &result);
- printf ("reply %d\n", result);
+ g_variant_get(reply, "(i)", &result);
+ g_variant_unref(reply);
+ printf("reply %d\n", result);
return 0;
}
@@ -143,7 +144,7 @@ int main(int argc, char *argv[])
{
if (argc != 2) {
- printf ("Usage %s [server|client]\n", argv[0]);
+ printf("Usage %s [server|client]\n", argv[0]);
exit (0);
}