From ea7b38d6749717bdcd335ef74810e7d97816d8ec Mon Sep 17 00:00:00 2001 From: "jaesick.shin" Date: Mon, 1 Aug 2016 13:20:54 +0900 Subject: [PATCH] Remove unused function and Related MessageList. Remove NSStorageDelete Function. Remove Related MessageList in NSProviderMemoryCache. MessagList is not required at current scenario. Change-Id: I751bd66a5b6b255c3fb1317ff5350cd008ae7496 Signed-off-by: jaesick.shin Reviewed-on: https://gerrit.iotivity.org/gerrit/9881 Tested-by: jenkins-iotivity Reviewed-by: Madan Lanka --- .../provider/cache/linux/NSProviderMemoryCache.c | 104 --------------------- 1 file changed, 104 deletions(-) diff --git a/service/notification/src/provider/cache/linux/NSProviderMemoryCache.c b/service/notification/src/provider/cache/linux/NSProviderMemoryCache.c index ca80395..305bd8f 100755 --- a/service/notification/src/provider/cache/linux/NSProviderMemoryCache.c +++ b/service/notification/src/provider/cache/linux/NSProviderMemoryCache.c @@ -193,28 +193,6 @@ NSResult NSStorageWrite(NSCacheList * list, NSCacheElement * newObj) } } - else if (type == NS_PROVIDER_CACHE_MESSAGE) - { - NS_LOG(DEBUG, "Type is MESSAGE"); - - NSCacheMsgData * msgData = (NSCacheMsgData *) newObj->data; - NSCacheElement * it = NSStorageRead(list, msgData->id); - - if (it) - { - NSCacheMsgData * itData = (NSCacheMsgData *) it->data; - - if (strcmp(itData->id, msgData->id) == 0) - { - - itData->messageType = msgData->messageType; - NS_LOG(DEBUG, "Updated messageType"); - pthread_mutex_unlock(&NSCacheMutex); - return NS_OK; - - } - } - } if (list->head == NULL) { @@ -230,56 +208,6 @@ NSResult NSStorageWrite(NSCacheList * list, NSCacheElement * newObj) return NS_OK; } -NSResult NSStorageDelete(NSCacheList * list, const char * delId) -{ - pthread_mutex_lock(&NSCacheMutex); - NSCacheElement * prev = list->head; - NSCacheElement * del = list->head; - - NSCacheType type = list->cacheType; - - if (NSProviderCompareIdCacheData(type, del->data, delId)) - { - if (del == list->head) // first object - { - if (del == list->tail) // first object (one object) - { - list->tail = del->next; - } - - list->head = del->next; - - NSProviderDeleteCacheData(type, del->data); - OICFree(del); - pthread_mutex_unlock(&NSCacheMutex); - return NS_OK; - } - } - - del = del->next; - while (del) - { - if (NSProviderCompareIdCacheData(type, del->data, delId)) - { - if (del == list->tail) // delete object same to last object - { - list->tail = prev; - } - - prev->next = del->next; - NSProviderDeleteCacheData(type, del->data); - OICFree(del); - pthread_mutex_unlock(&NSCacheMutex); - return NS_OK; - } - - prev = del; - del = del->next; - } - pthread_mutex_unlock(&NSCacheMutex); - return NS_OK; -} - NSResult NSStorageDestroy(NSCacheList * list) { NSCacheElement * iter = list->head; @@ -328,19 +256,6 @@ bool NSProviderCompareIdCacheData(NSCacheType type, void * data, const char * id return false; } - else if (type == NS_PROVIDER_CACHE_MESSAGE) - { - NSCacheMsgData * msgData = (NSCacheMsgData *) data; - - if (strcmp(msgData->id, id) == 0) - { - NS_LOG(DEBUG, "Message Data is Same"); - return true; - } - - NS_LOG(DEBUG, "Message Data is Not Same"); - return false; - } NS_LOG(DEBUG, "NSProviderCompareIdCacheData - OUT"); @@ -363,25 +278,6 @@ NSResult NSProviderDeleteCacheData(NSCacheType type, void * data) return NS_OK; } - else if (type == NS_PROVIDER_CACHE_MESSAGE) - { - NSCacheMsgData * msgData = (NSCacheMsgData *) data; - - if (msgData->id) - { - OICFree(msgData->id); - msgData->id = NULL; - } - - if (msgData->nsMessage) - { - NSFreeMessage(msgData->nsMessage); - } - - OICFree(msgData); - - return NS_OK; - } return NS_OK; } -- 2.7.4