From: Sebastian Harl Date: Sat, 17 Aug 2013 16:55:16 +0000 (+0200) Subject: store: Removed now duplicate code. X-Git-Tag: sysdb-0.1.0~386 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0f606423bfbb9cfd30d2e55ca9b0f231ded24cfe;p=sysdb.git store: Removed now duplicate code. When creating a new host object, the services/attributes list are always initialized to an empty list object. No need to further check this anymore. This was only required in earlier code when copying a user-provided host object. --- diff --git a/src/core/store.c b/src/core/store.c index 50991fc..6deb699 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -316,30 +316,6 @@ sdb_store_host(const char *name, sdb_time_t last_update) free(SDB_OBJ(new)->name); SDB_OBJ(new)->name = cname; - if (! new->attributes) { - if (! (new->attributes = sdb_llist_create())) { - char errbuf[1024]; - sdb_log(SDB_LOG_ERR, "store: Failed to initialize " - "host object '%s': %s", SDB_OBJ(new)->name, - sdb_strerror(errno, errbuf, sizeof(errbuf))); - sdb_object_deref(SDB_OBJ(new)); - pthread_rwlock_unlock(&host_lock); - return -1; - } - } - - if (! new->services) { - if (! (new->services = sdb_llist_create())) { - char errbuf[1024]; - sdb_log(SDB_LOG_ERR, "store: Failed to initialize " - "host object '%s': %s", SDB_OBJ(new)->name, - sdb_strerror(errno, errbuf, sizeof(errbuf))); - sdb_object_deref(SDB_OBJ(new)); - pthread_rwlock_unlock(&host_lock); - return -1; - } - } - status = sdb_llist_insert_sorted(host_list, SDB_OBJ(new), sdb_object_cmp_by_name);