Remove unused function and Related MessageList.
authorjaesick.shin <jaesick.shin@samsung.com>
Mon, 1 Aug 2016 04:20:54 +0000 (13:20 +0900)
committerMadan Lanka <lanka.madan@samsung.com>
Tue, 2 Aug 2016 06:12:38 +0000 (06:12 +0000)
Remove NSStorageDelete Function.
Remove Related MessageList in NSProviderMemoryCache.
MessagList is not required at current scenario.

Change-Id: I751bd66a5b6b255c3fb1317ff5350cd008ae7496
Signed-off-by: jaesick.shin <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/9881
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
service/notification/src/provider/cache/linux/NSProviderMemoryCache.c

index ca803959d84c4873320ef2e055f422368940adb8..305bd8feb94dd41ecd7c5c1903873794f6945355 100755 (executable)
@@ -193,28 +193,6 @@ NSResult NSStorageWrite(NSCacheList * list, NSCacheElement * newObj)
         }\r
 \r
     }\r
-    else if (type == NS_PROVIDER_CACHE_MESSAGE)\r
-    {\r
-        NS_LOG(DEBUG, "Type is MESSAGE");\r
-\r
-        NSCacheMsgData * msgData = (NSCacheMsgData *) newObj->data;\r
-        NSCacheElement * it = NSStorageRead(list, msgData->id);\r
-\r
-        if (it)\r
-        {\r
-            NSCacheMsgData * itData = (NSCacheMsgData *) it->data;\r
-\r
-            if (strcmp(itData->id, msgData->id) == 0)\r
-            {\r
-\r
-                itData->messageType = msgData->messageType;\r
-                NS_LOG(DEBUG, "Updated messageType");\r
-                pthread_mutex_unlock(&NSCacheMutex);\r
-                return NS_OK;\r
-\r
-            }\r
-        }\r
-    }\r
 \r
     if (list->head == NULL)\r
     {\r
@@ -230,56 +208,6 @@ NSResult NSStorageWrite(NSCacheList * list, NSCacheElement * newObj)
     return NS_OK;\r
 }\r
 \r
-NSResult NSStorageDelete(NSCacheList * list, const char * delId)\r
-{\r
-    pthread_mutex_lock(&NSCacheMutex);\r
-    NSCacheElement * prev = list->head;\r
-    NSCacheElement * del = list->head;\r
-\r
-    NSCacheType type = list->cacheType;\r
-\r
-    if (NSProviderCompareIdCacheData(type, del->data, delId))\r
-    {\r
-        if (del == list->head) // first object\r
-        {\r
-            if (del == list->tail) // first object (one object)\r
-            {\r
-                list->tail = del->next;\r
-            }\r
-\r
-            list->head = del->next;\r
-\r
-            NSProviderDeleteCacheData(type, del->data);\r
-            OICFree(del);\r
-            pthread_mutex_unlock(&NSCacheMutex);\r
-            return NS_OK;\r
-        }\r
-    }\r
-\r
-    del = del->next;\r
-    while (del)\r
-    {\r
-        if (NSProviderCompareIdCacheData(type, del->data, delId))\r
-        {\r
-            if (del == list->tail) // delete object same to last object\r
-            {\r
-                list->tail = prev;\r
-            }\r
-\r
-            prev->next = del->next;\r
-            NSProviderDeleteCacheData(type, del->data);\r
-            OICFree(del);\r
-            pthread_mutex_unlock(&NSCacheMutex);\r
-            return NS_OK;\r
-        }\r
-\r
-        prev = del;\r
-        del = del->next;\r
-    }\r
-    pthread_mutex_unlock(&NSCacheMutex);\r
-    return NS_OK;\r
-}\r
-\r
 NSResult NSStorageDestroy(NSCacheList * list)\r
 {\r
     NSCacheElement * iter = list->head;\r
@@ -328,19 +256,6 @@ bool NSProviderCompareIdCacheData(NSCacheType type, void * data, const char * id
         return false;\r
 \r
     }\r
-    else if (type == NS_PROVIDER_CACHE_MESSAGE)\r
-    {\r
-        NSCacheMsgData * msgData = (NSCacheMsgData *) data;\r
-\r
-        if (strcmp(msgData->id, id) == 0)\r
-        {\r
-            NS_LOG(DEBUG, "Message Data is Same");\r
-            return true;\r
-        }\r
-\r
-        NS_LOG(DEBUG, "Message Data is Not Same");\r
-        return false;\r
-    }\r
 \r
     NS_LOG(DEBUG, "NSProviderCompareIdCacheData - OUT");\r
 \r
@@ -363,25 +278,6 @@ NSResult NSProviderDeleteCacheData(NSCacheType type, void * data)
 \r
         return NS_OK;\r
     }\r
-    else if (type == NS_PROVIDER_CACHE_MESSAGE)\r
-    {\r
-        NSCacheMsgData * msgData = (NSCacheMsgData *) data;\r
-\r
-        if (msgData->id)\r
-        {\r
-            OICFree(msgData->id);\r
-            msgData->id = NULL;\r
-        }\r
-\r
-        if (msgData->nsMessage)\r
-        {\r
-            NSFreeMessage(msgData->nsMessage);\r
-        }\r
-\r
-        OICFree(msgData);\r
-\r
-        return NS_OK;\r
-    }\r
 \r
     return NS_OK;\r
 }\r