Remove unnecessary query in AppQueryInterface::IsPkgInstalled() 26/133526/8
authorDamian Pietruchowski <d.pietruchow@samsung.com>
Mon, 12 Jun 2017 14:12:29 +0000 (16:12 +0200)
committerDamian Pietruchowski <d.pietruchow@samsung.com>
Thu, 24 Aug 2017 12:00:04 +0000 (14:00 +0200)
One of the ci::QueryIsPackageInstalled() calling is unnecessary.

Change-Id: I4c0fa68a1856543dc5e09d6777be97a9fad172f1
Signed-off-by: Damian Pietruchowski <d.pietruchow@samsung.com>
src/common/app_query_interface.cc

index f3e6602..02cfe88 100644 (file)
@@ -12,18 +12,13 @@ namespace bs = boost::system;
 namespace common_installer {
 
 bool AppQueryInterface::IsPkgInstalled(const std::string& arg,
-                                       uid_t uid) const {
-  // argument from commandline is package id
-  PkgQueryInterface pkg_query(arg, uid);
-  if (pkg_query.IsPackageInstalled(GetRequestMode(uid)))
-    return true;
-
+    uid_t uid) const {
   // argument from commandline is path to file
   std::string pkg_id = GetPkgIdFromPath(arg);
   if (pkg_id.empty())
-    return false;
-  PkgQueryInterface pkg_query2(pkg_id, uid);
-  return pkg_query2.IsPackageInstalled(GetRequestMode(uid));
+    pkg_id = arg;
+  PkgQueryInterface pkg_query(pkg_id, uid);
+  return pkg_query.IsPackageInstalled(GetRequestMode(uid));
 }
 
 std::string AppQueryInterface::GetPkgId(const std::string& arg) const {