diff options
author | Mukund Sivaraman <muks@banu.com> | 2008-08-24 10:45:29 +0530 |
---|---|---|
committer | Mukund Sivaraman <muks@banu.com> | 2008-08-24 10:45:29 +0530 |
commit | 90c1bb4b738dadc78867dcaec45993fc26a15233 (patch) | |
tree | 532bdee982e8ed1ab3d5070dd64c4f26fdde7caf | |
parent | 039273c134fe02b5440a5a9e962d9fde596a3dee (diff) |
Remove useless check as data can't be NULL at this point
-rw-r--r-- | src/hashmap.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/hashmap.c b/src/hashmap.c index 6185dcf..292c006 100644 --- a/src/hashmap.c +++ b/src/hashmap.c @@ -215,16 +215,12 @@ hashmap_insert(hashmap_t map, const char *key, const void *data, size_t len) if (!key_copy) return -ENOMEM; - if (data) { - data_copy = safemalloc(len); - if (!data_copy) { - safefree(key_copy); - return -ENOMEM; - } - memcpy(data_copy, data, len); - } else { - data_copy = NULL; - } + data_copy = safemalloc(len); + if (!data_copy) { + safefree(key_copy); + return -ENOMEM; + } + memcpy(data_copy, data, len); ptr = safemalloc(sizeof(struct hashentry_s)); if (!ptr) { |