[CodeClean] Remove pipeline module related code from gdbus-util
authorYongjoo Ahn <yongjoo1.ahn@samsung.com>
Wed, 29 Mar 2023 08:37:42 +0000 (17:37 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Fri, 31 Mar 2023 02:35:01 +0000 (11:35 +0900)
- Move pipeline related code in gdbus-util to proper src.
- Adjust function names to the model-impl.

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
daemon/gdbus-util.c
daemon/includes/gdbus-util.h
daemon/pipeline-dbus-impl.cc

index c7f3858..e6c9935 100644 (file)
@@ -115,34 +115,6 @@ gdbus_disconnect_signal (gpointer instance, int num_signals,
 }
 
 /**
- * @brief Cleanup the instance of the DBus interface.
- */
-static void
-put_instance (gpointer * instance)
-{
-  g_object_unref (*instance);
-  *instance = NULL;
-}
-
-/**
- * @brief Get the skeleton object of the DBus interface.
- */
-MachinelearningServicePipeline *
-gdbus_get_instance_pipeline (void)
-{
-  return machinelearning_service_pipeline_skeleton_new ();
-}
-
-/**
- * @brief Put the obtained skeleton object and release the resource.
- */
-void
-gdbus_put_instance_pipeline (MachinelearningServicePipeline ** instance)
-{
-  put_instance ((gpointer *) instance);
-}
-
-/**
  * @brief Connect to the DBus message bus, which type is SYSTEM.
  */
 int
index 4a7f77d..b53fe18 100644 (file)
@@ -22,8 +22,6 @@
 #include <gio/gio.h>
 #include <stdbool.h>
 
-#include "pipeline-dbus.h"
-
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
@@ -41,7 +39,6 @@ struct gdbus_signal_info
 
 /**
  * @brief Export the DBus interface at the Object path on the bus connection.
- * 
  * @param instance The instance of the DBus interface to export.
  * @param obj_path The path to export the interface at.
  * @return @c 0 on success. Otherwise a negative error value.
@@ -76,22 +73,8 @@ void gdbus_disconnect_signal (gpointer instance, int num_signals,
     struct gdbus_signal_info *signal_infos);
 
 /**
- * @brief Get the skeleton object of the DBus interface.
- * @remarks If the function succeeds, @a MachinelearningServicePipeline*
- * should be released using gdbus_put_instance_pipeline().
- * @return MachinelearningServiceProcess* The skeleton object.
- */
-MachinelearningServicePipeline *gdbus_get_instance_pipeline (void);
-
-/**
- * @brief Put the obtained skeleton object and release the resource.
- * @param instance The obtained skeleton object of the DBus interface.
- */
-void gdbus_put_instance_pipeline (MachinelearningServicePipeline ** instance);
-
-/**
  * @brief Connect to the DBus message bus
- * @param is_session Ture is DBus Bus type is session.
+ * @param is_session True is DBus Bus type is session.
  * @return @c 0 on success. Otherwise a negative error value.
  */
 int gdbus_get_system_connection (gboolean is_session);
index 05cff3f..6fa1596 100644 (file)
@@ -26,6 +26,7 @@
 #include <gdbus-util.h>
 #include <log.h>
 
+#include "pipeline-dbus.h"
 #include "service-db.hh"
 #include "dbus-interface.h"
 
@@ -69,6 +70,24 @@ static void _pipeline_free (gpointer data)
 }
 
 /**
+ * @brief Get the skeleton object of the DBus interface.
+ */
+static MachinelearningServicePipeline *
+gdbus_get_pipeline_instance (void)
+{
+  return machinelearning_service_pipeline_skeleton_new ();
+}
+
+/**
+ * @brief Put the obtained skeleton object and release the resource.
+ */
+static void
+gdbus_put_pipeline_instance (MachinelearningServicePipeline ** instance)
+{
+  g_clear_object (instance);
+}
+
+/**
  * @brief Set the service with given description. Return the call result.
  */
 static gboolean dbus_cb_core_set_pipeline (MachinelearningServicePipeline *obj,
@@ -458,7 +477,7 @@ static int probe_pipeline_module (void *data)
 {
   int ret = 0;
 
-  g_gdbus_instance = gdbus_get_instance_pipeline ();
+  g_gdbus_instance = gdbus_get_pipeline_instance ();
   if (g_gdbus_instance == NULL) {
     _E ("cannot get a dbus instance for the %s interface\n",
         DBUS_PIPELINE_INTERFACE);
@@ -488,7 +507,7 @@ out_disconnect:
   gdbus_disconnect_signal (g_gdbus_instance,
       ARRAY_SIZE (handler_infos), handler_infos);
 out:
-  gdbus_put_instance_pipeline (&g_gdbus_instance);
+  gdbus_put_pipeline_instance (&g_gdbus_instance);
 
   return ret;
 }
@@ -528,7 +547,7 @@ static void exit_pipeline_module (void *data)
 
   gdbus_disconnect_signal (g_gdbus_instance,
       ARRAY_SIZE (handler_infos), handler_infos);
-  gdbus_put_instance_pipeline (&g_gdbus_instance);
+  gdbus_put_pipeline_instance (&g_gdbus_instance);
 }
 
 static const struct module_ops pipeline_ops = {