Avoid appId and pkgId copying in AppInstallHelper 14/229814/3
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Fri, 3 Apr 2020 20:11:49 +0000 (22:11 +0200)
committerZofia Abramowska <z.abramowska@samsung.com>
Thu, 9 Apr 2020 16:27:38 +0000 (16:27 +0000)
Change-Id: Ief63d53563143a18358b435a374685c9317ecbd7

src/common/app_install_helper.cpp
src/common/app_install_helper.h

index 1f6e0e8..2493bfe 100644 (file)
@@ -159,12 +159,12 @@ std::string AppInstallHelper::getSharedROPath(int i, RootType type) const {
     return getPath(SECURITY_MANAGER_PATH_OWNER_RW_OTHER_RO, PathType::FILE, i, type);
 }
 
-std::string AppInstallHelper::getAppId() const {
-    return m_appName + "_app_id";
+const std::string& AppInstallHelper::getAppId() const {
+    return m_appName;
 }
 
-std::string AppInstallHelper::getPkgId() const {
-    return m_pkgName + "_pkg_id";
+const std::string& AppInstallHelper::getPkgId() const {
+    return m_pkgName;
 }
 
 void AppInstallHelper::setVersion(const std::string &version) {
@@ -368,4 +368,3 @@ void AppInstallHelper::setInstallType(app_install_type type) {
 app_install_type AppInstallHelper::getInstallType() const {
     return m_installType;
 }
-
index cefeb71..9841481 100644 (file)
@@ -38,7 +38,7 @@ struct AppInstallHelper {
                      bool isLocal,
                      uid_t uid,
                      std::string version = std::string())
-      : m_appName(appNamePrefix), m_pkgName(pkgNamePrefix), m_isLocal(isLocal), m_uidGid(uid), m_version(version),
+      : m_appName(appNamePrefix + "_app_id"), m_pkgName(pkgNamePrefix + "_pkg_id"), m_isLocal(isLocal), m_uidGid(uid), m_version(version),
         m_installType(SM_APP_INSTALL_NONE), m_isHybrid(false), m_creatorPid(getpid())
     {}
 
@@ -74,8 +74,8 @@ struct AppInstallHelper {
     AppInstallHelper(AppInstallHelper &&other);
 
     // App info getters and setters
-    std::string getAppId() const;
-    std::string getPkgId() const;
+    const std::string& getAppId() const;
+    const std::string& getPkgId() const;
     int getUID() const;
     int getGID() const;
     void setVersion(const std::string &version);
@@ -163,8 +163,8 @@ protected:
                        RootType rType = RootType::BASE);
     void createInstallDir(RootType type);
 
-    std::string m_appName;
-    std::string m_pkgName;
+    const std::string m_appName;
+    const std::string m_pkgName;
     bool m_isLocal;
     int m_uidGid;
     std::string m_version;