From 90c1bb4b738dadc78867dcaec45993fc26a15233 Mon Sep 17 00:00:00 2001 From: Mukund Sivaraman Date: Sun, 24 Aug 2008 10:45:29 +0530 Subject: Remove useless check as data can't be NULL at this point --- src/hashmap.c | 16 ++++++---------- 1 file 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) { -- cgit v1.2.3