Refactor pkgmgr-info
[platform/core/appfw/pkgmgr-info.git] / src / server / database / depinfo_db_handler.cc
index 3362a19..6cbb03a 100644 (file)
@@ -49,21 +49,16 @@ int DepInfoGetDBHandler::Execute() {
     LOG(ERROR) << "Failed to connect database";
     return PMINFO_R_ERROR;
   }
-  GList* list = nullptr;
-  std::vector<std::pair<sqlite3*, uid_t>> conn_list = GetConnection();
+
+  const auto& conn_list = GetConnection();
   int ret = PMINFO_R_OK;
-  for (auto& conn : conn_list) {
-    ret = pkginfo_internal_filter_get_depends_on(
-        conn.first, pkgid_.c_str(), &list);
+  dependency_list_.clear();
+  for (const auto& conn : conn_list) {
+    ret = internal::GetDependsOn(conn.first, pkgid_, dependency_list_);
     if (ret == PMINFO_R_ERROR)
       break;
   }
 
-  for (GList* tmp = list; tmp; tmp = tmp->next)
-    dependency_list_.emplace_back(reinterpret_cast<dependency_x *>(tmp->data));
-
-  g_list_free(list);
-
   return ret;
 }