Code

store: Removed now duplicate code.
authorSebastian Harl <sh@tokkee.org>
Sat, 17 Aug 2013 16:55:16 +0000 (18:55 +0200)
committerSebastian Harl <sh@tokkee.org>
Sat, 17 Aug 2013 16:55:16 +0000 (18:55 +0200)
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.

src/core/store.c

index 50991fcea78c244b17eef8e4b0dbbd98acb6ea5a..6deb699024d9b1f90052834efb55d4bcb3abd83a 100644 (file)
@@ -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);