summaryrefslogtreecommitdiff
path: root/src/persistence_client_library_handle.c
diff options
context:
space:
mode:
authorIngo Huerner <ingo.huerner@xse.de>2015-01-22 13:45:40 +0100
committerIngo Huerner <ingo.huerner@xse.de>2015-01-22 13:45:40 +0100
commit84210e9a13cf8b6b7496d0ed1615377a142cfe53 (patch)
treefc7302cc63beda45b2e18d9e48831dbaad230d64 /src/persistence_client_library_handle.c
parent9b810c249128d4c9d593445c71e0cb0f42f9e749 (diff)
downloadpersistence-client-library-84210e9a13cf8b6b7496d0ed1615377a142cfe53.tar.gz
Update after static code analysis (Coverity https://scan.coverity.com/projects/301)
Diffstat (limited to 'src/persistence_client_library_handle.c')
-rw-r--r--src/persistence_client_library_handle.c68
1 files changed, 28 insertions, 40 deletions
diff --git a/src/persistence_client_library_handle.c b/src/persistence_client_library_handle.c
index b5be100..b88f065 100644
--- a/src/persistence_client_library_handle.c
+++ b/src/persistence_client_library_handle.c
@@ -369,17 +369,15 @@ void set_file_backup_status(int idx, int status)
FileHandleTreeItem_s* newItem = malloc(sizeof(FileHandleTreeItem_s));
if(newItem != NULL)
{
- if(newItem->value.payload != NULL)
- {
- memcpy(newItem->value.payload , foundItem->value.payload, sizeof(FileHandleData_u) ); // duplicate value
+ memcpy(newItem->value.payload , foundItem->value.payload, sizeof(FileHandleData_u) ); // duplicate value
- newItem->key = idx;
- newItem->value.fileHandle.backupCreated = status;
+ newItem->key = idx;
+ newItem->value.fileHandle.backupCreated = status;
- jsw_rberase(gFileHandleTree, foundItem);
+ jsw_rberase(gFileHandleTree, foundItem);
+
+ jsw_rbinsert(gFileHandleTree, newItem);
- jsw_rbinsert(gFileHandleTree, newItem);
- }
free(newItem);
}
}
@@ -450,16 +448,13 @@ void set_file_cache_status(int idx, int status)
FileHandleTreeItem_s* newItem = malloc(sizeof(FileHandleTreeItem_s));
if(newItem != NULL)
{
- if(newItem->value.payload != NULL)
- {
- memcpy(newItem->value.payload , foundItem->value.payload, sizeof(FileHandleData_u) ); // duplicate value
+ memcpy(newItem->value.payload , foundItem->value.payload, sizeof(FileHandleData_u) ); // duplicate value
- jsw_rberase(gFileHandleTree, foundItem);
+ jsw_rberase(gFileHandleTree, foundItem);
- newItem->key = idx;
- newItem->value.fileHandle.cacheStatus = status;
- jsw_rbinsert(gFileHandleTree, newItem);
- }
+ newItem->key = idx;
+ newItem->value.fileHandle.cacheStatus = status;
+ jsw_rbinsert(gFileHandleTree, newItem);
free(newItem);
}
}
@@ -529,16 +524,14 @@ void set_file_user_id(int idx, int userID)
FileHandleTreeItem_s* newItem = malloc(sizeof(FileHandleTreeItem_s));
if(newItem != NULL)
{
- if(newItem->value.payload != NULL)
- {
- memcpy(newItem->value.payload , foundItem->value.payload, sizeof(FileHandleData_u) ); // duplicate value
+ memcpy(newItem->value.payload , foundItem->value.payload, sizeof(FileHandleData_u) ); // duplicate value
+
+ jsw_rberase(gFileHandleTree, foundItem);
- jsw_rberase(gFileHandleTree, foundItem);
+ newItem->key = idx;
+ newItem->value.fileHandle.userId = userID;
+ jsw_rbinsert(gFileHandleTree, newItem);
- newItem->key = idx;
- newItem->value.fileHandle.userId = userID;
- jsw_rbinsert(gFileHandleTree, newItem);
- }
free(newItem);
}
}
@@ -738,16 +731,14 @@ void set_ossfile_file_path(int idx, char* file)
FileHandleTreeItem_s* newItem = malloc(sizeof(FileHandleTreeItem_s));
if(newItem != NULL)
{
- if(newItem->value.payload != NULL)
- {
- memcpy(newItem->value.payload , foundItem->value.payload, sizeof(FileHandleData_u) ); // duplicate value
+ memcpy(newItem->value.payload , foundItem->value.payload, sizeof(FileHandleData_u) ); // duplicate value
+
+ jsw_rberase(gFileHandleTree, foundItem);
- jsw_rberase(gFileHandleTree, foundItem);
+ newItem->key = idx;
+ newItem->value.fileHandle.filePath = file;
+ jsw_rbinsert(gFileHandleTree, newItem);
- newItem->key = idx;
- newItem->value.fileHandle.filePath = file;
- jsw_rbinsert(gFileHandleTree, newItem);
- }
free(newItem);
}
}
@@ -813,17 +804,14 @@ void set_ossfile_backup_status(int idx, int status)
FileHandleTreeItem_s* newItem = malloc(sizeof(FileHandleTreeItem_s));
if(newItem != NULL)
{
- if(newItem->value.payload != NULL)
- {
- memcpy(newItem->value.payload , foundItem->value.payload, sizeof(FileHandleData_u) ); // duplicate value
+ memcpy(newItem->value.payload , foundItem->value.payload, sizeof(FileHandleData_u) ); // duplicate value
- newItem->key = idx;
- newItem->value.fileHandle.backupCreated = status;
+ newItem->key = idx;
+ newItem->value.fileHandle.backupCreated = status;
- jsw_rberase(gFileHandleTree, foundItem);
+ jsw_rberase(gFileHandleTree, foundItem);
- jsw_rbinsert(gFileHandleTree, newItem);
- }
+ jsw_rbinsert(gFileHandleTree, newItem);
free(newItem);
}
}