From d80d81533edd025b996a3180beb6a52dbd7fb589 Mon Sep 17 00:00:00 2001 From: Krzysztof Jackiewicz Date: Fri, 3 Apr 2020 22:11:49 +0200 Subject: [PATCH] Avoid appId and pkgId copying in AppInstallHelper Change-Id: Ief63d53563143a18358b435a374685c9317ecbd7 --- src/common/app_install_helper.cpp | 9 ++++----- src/common/app_install_helper.h | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/common/app_install_helper.cpp b/src/common/app_install_helper.cpp index 1f6e0e8..2493bfe 100644 --- a/src/common/app_install_helper.cpp +++ b/src/common/app_install_helper.cpp @@ -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; } - diff --git a/src/common/app_install_helper.h b/src/common/app_install_helper.h index cefeb71..9841481 100644 --- a/src/common/app_install_helper.h +++ b/src/common/app_install_helper.h @@ -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; -- 2.7.4