libsystem-sd: use conrresponding macro for each type
authorWaLyong Cho <walyong.cho@samsung.com>
Wed, 23 Nov 2016 07:03:10 +0000 (16:03 +0900)
committerWaLyong Cho <walyong.cho@samsung.com>
Wed, 23 Nov 2016 07:03:10 +0000 (16:03 +0900)
Change-Id: I711554f8e4cf372b5916d06ed28c9c2f0f0298a5
Signed-off-by: WaLyong Cho <walyong.cho@samsung.com>
src/libsystem-sd/systemd.c

index cfcd5d6..ab0439b 100644 (file)
@@ -87,7 +87,7 @@ static int systemd_call_sync(GDBusConnection *connection,
                                                    NULL,
                                                    &err);
         else {
-                g_autofree GDBusProxy *proxy = NULL;
+                g_autoptr(GDBusProxy) proxy = NULL;
 
                 proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
                                                       G_DBUS_PROXY_FLAGS_NONE,
@@ -125,8 +125,8 @@ static int systemd_call_sync(GDBusConnection *connection,
 }
 
 int systemd_subscribe(GDBusConnection *connection, char **err_msg) {
-        g_autofree GVariant *reply = NULL;
-        g_autofree GError *error = NULL;
+        g_autoptr(GVariant) reply = NULL;
+        g_autoptr(GError) error = NULL;
         int r;
 
         r = systemd_call_sync(connection,
@@ -148,8 +148,8 @@ int systemd_subscribe(GDBusConnection *connection, char **err_msg) {
 }
 
 int systemd_unsubscribe(GDBusConnection *connection, char **err_msg) {
-        g_autofree GVariant *reply = NULL;
-        g_autofree GError *error = NULL;
+        g_autoptr(GVariant) reply = NULL;
+        g_autoptr(GError) error = NULL;
         int r;
 
         r = systemd_call_sync(connection,
@@ -175,8 +175,8 @@ int systemd_get_unit(GDBusConnection *connection,
                      char **unit,
                      char **err_msg) {
 
-        g_autofree GVariant *reply = NULL;
-        g_autofree GError *error = NULL;
+        g_autoptr(GVariant) reply = NULL;
+        g_autoptr(GError) error = NULL;
         char *obj = NULL;
         int r;
 
@@ -219,8 +219,8 @@ int systemd_control_unit(GDBusConnection *connection,
                          char **job,
                          char **err_msg) {
 
-        g_autofree GVariant *reply = NULL;
-        g_autofree GError *error = NULL;
+        g_autoptr(GVariant) reply = NULL;
+        g_autoptr(GError) error = NULL;
         char *obj = NULL;
         int r;
 
@@ -347,7 +347,7 @@ static int systemd_get_property(GDBusConnection *connection,
                                 GVariant **variant,
                                 char **err_msg) {
 
-        g_autofree GError *error = NULL;
+        g_autoptr(GError) error = NULL;
         int r;
 
         assert(name);
@@ -471,7 +471,7 @@ static int systemd_get_service_property(GDBusConnection *connection,
                         value* result,                                  \
                         char** err_msg) {                               \
                                                                         \
-                g_autofree GVariant *var = NULL, *inner = NULL;         \
+                g_autoptr(GVariant) var = NULL, inner = NULL;           \
                 int r;                                                  \
                                                                         \
                 assert(target);                                         \
@@ -606,7 +606,7 @@ void systemd_unit_status_list_free_full(GList *status_list) {
 static int systemd_parse_list_units_result(GVariant *result, GList **unit_list) {
         char *name, *description, *load_state, *active_state, *sub_state;
         char *followed, *obj_path, *job_type, *job_obj_path;
-        g_autofree GVariantIter *iter;
+        g_autoptr(GVariantIter) iter;
         unsigned int job_id;
         GList *list = NULL;
         int r;
@@ -728,8 +728,8 @@ on_error:
 }
 
 int systemd_get_units_list(GDBusConnection *conn, GList **unit_list, char **err_msg) {
-        g_autofree GVariant *reply = NULL;
-        g_autofree GError *error = NULL;
+        g_autoptr(GVariant) reply = NULL;
+        g_autoptr(GError) error = NULL;
         int r;
 
         assert(unit_list);
@@ -786,7 +786,7 @@ void systemd_unit_file_status_list_free_full(GList *status_list) {
 }
 
 static int systemd_parse_list_unit_files_result(GVariant *result, GList **unit_files_list) {
-        g_autofree GVariantIter *iter;
+        g_autoptr(GVariantIter) iter;
         GList *list = NULL;
         char *name, *status;
         int r;
@@ -843,8 +843,8 @@ on_error:
 }
 
 int systemd_get_unit_files_list(GDBusConnection *conn, GList **unit_files_list, char **err_msg) {
-        g_autofree GVariant *reply = NULL;
-        g_autofree GError *error = NULL;
+        g_autoptr(GVariant) reply = NULL;
+        g_autoptr(GError) error = NULL;
         int r;
 
         assert(conn);