remove duplicate logic 38/75538/2 accepted/tizen/common/20160620.163904 accepted/tizen/mobile/20160621.084104 submit/tizen/20160620.100245
authorKyoungyong Lee <bluevox@naver.com>
Mon, 20 Jun 2016 09:55:08 +0000 (18:55 +0900)
committerKyoungyong Lee <bluevox@naver.com>
Mon, 20 Jun 2016 09:59:37 +0000 (18:59 +0900)
Change-Id: I7cc196f7094a9882d5683ccc4b8f83a7e7c482c3

pkgmgr_plugin/privileges.cpp
server/src/CynaraService.cpp
server/src/PrivacyGuardDaemon.cpp
server/src/PrivacyGuardDb.cpp

index b00f9a7..fb0c208 100755 (executable)
@@ -36,13 +36,10 @@ void destroy_char_list(char** ppList, int size)
 
        if (ppList) {
                for (i = 0; i < size; ++i) {
-                       if (ppList[i]) {
+                       if (ppList[i])
                                free(ppList[i]);
-                       }
-               }
-               if (ppList) {
-                       free(ppList);
                }
+               free(ppList);
        }
 }
 
@@ -65,7 +62,7 @@ int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char* packageId)
        LOGD("PKGMGR_PARSER_PLUGIN_INSTALL() called with [%s].", packageId);
 
        uid_t user_id = getuid();
-       LOGD("Current userid is %d.", user_id);
+       LOGD("user_id is %d.", user_id);
 
        int ret = 0;
 
@@ -75,6 +72,7 @@ int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char* packageId)
                LOGE("Failed to get the element. xmlFirstElementChild() returned NULL.");
                return -EINVAL;
        }
+
        curPtr = curPtr->xmlChildrenNode;
        if (curPtr == NULL) {
                LOGE("No privileges");
@@ -95,8 +93,8 @@ int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char* packageId)
                curPtr = curPtr->next;
        }
 
-       char** ppPrivilegeList = (char**) calloc(privilegeList.size() + 1, sizeof(char*));
-       char** temp = ppPrivilegeList;
+       char **ppPrivilegeList = (char**) calloc(privilegeList.size() + 1, sizeof(char*));
+       char **temp = ppPrivilegeList;
        std::list <std::string>::iterator iter = privilegeList.begin();
        for (size_t i = 0; i < privilegeList.size(); ++i) {
                ppPrivilegeList[i] = (char*)calloc(strlen(iter->c_str()) + 1, sizeof(char));
index 5a39e99..b036e2a 100755 (executable)
@@ -33,6 +33,7 @@
 #include "PrivacyIdInfo.h"
 
 #define BUF_SIZE 256
+#define ONE_SEC (SLEEP_TIME * 20)
 
 static cynara_monitor_configuration *p_conf;
 static cynara_monitor *p_cynara_monitor;
@@ -57,7 +58,7 @@ CynaraService::~CynaraService(void)
 int
 CynaraService::initialize(void)
 {
-       PG_LOGD("[cynara_service] CynaraService initializing");
+       PG_LOGD("initializing CynaraService..");
 
        int res = cynara_monitor_configuration_create(&p_conf);
        if(res != CYNARA_API_SUCCESS){
@@ -87,7 +88,7 @@ CynaraService::initialize(void)
 int
 CynaraService::start(void)
 {
-       PG_LOGI("[cynara_service] CynaraService starting");
+       PG_LOGI("starting CynaraService..");
 
        int res = 0;
        char buf[256];
@@ -120,7 +121,7 @@ CynaraService::start(void)
 void*
 CynaraService::getEntriesThread(void* pData)
 {
-       PG_LOGD("[cynara_service] Running get entries thread");
+       PG_LOGD("Running get entries thread");
 
        int res = -1;
 
@@ -149,7 +150,7 @@ CynaraService::getEntriesThread(void* pData)
                        PG_LOGD("ok, i'm wakeup..");
                        pthread_mutex_unlock(&g_mutex);
 #else
-                       usleep(SLEEP_TIME * 20);        // 1 SEC
+                       usleep(ONE_SEC);        // 1 SEC
 #endif
                } else {
                        if (monitor_entries) {
index f16a733..c57e38d 100755 (executable)
@@ -97,8 +97,8 @@ PrivacyGuardDaemon::stop(void)
        PG_LOGD("calling pSocketService->stop()");
        pSocketService->stop();
 
-//     PG_LOGD("calling pCynaraService->stop()");
-//     pCynaraService->stop();
+       PG_LOGD("calling pCynaraService->stop()");
+       pCynaraService->stop();
 
        return 0;
 }
@@ -108,8 +108,9 @@ PrivacyGuardDaemon::shutdown(void)
 {
        PG_LOGD("calling pSocketService->shutdown()");
        pSocketService->shutdown();
-//     PG_LOGD("calling pCynaraService->shutdown()");
-//     pCynaraService->shutdown();
+
+       PG_LOGD("calling pCynaraService->shutdown()");
+       pCynaraService->shutdown();
 
        return 0;
 }
index ef72cb2..ff54f18 100755 (executable)
@@ -17,7 +17,6 @@
 #include <sstream>
 #include <fstream>
 #include <sqlite3.h>
-#include <pkgmgr-info.h>
 #include <time.h>
 #include <privilege_info.h>
 #include <cynara-monitor.h>