diff --git a/src/core/store.c b/src/core/store.c
index 64e9f64064c50956b6afe56ed4dc35f5d9e5b72b..b9335818c203a753cd3fa84ae2db18b270e7cfe7 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
const sdb_host_t *host = (const sdb_host_t *)obj;
sdb_host_t *new;
- new = sdb_host_create(obj->name);
+ new = SDB_HOST(sdb_object_create(obj->name, sdb_host_type));
if (! new)
return NULL;
* public API
*/
-sdb_host_t *
-sdb_host_create(const char *name)
-{
- sdb_object_t *obj;
-
- if (! name)
- return NULL;
-
- obj = sdb_object_create(name, sdb_host_type);
- if (! obj)
- return NULL;
- return SDB_HOST(obj);
-} /* sdb_host_create */
-
int
-sdb_store_host(const sdb_host_t *host)
+sdb_store_host(const char *name, sdb_time_t last_update)
{
- char *cname;
-
- sdb_time_t last_update;
sdb_host_t *old;
+ char *cname;
int status = 0;
- if ((! host) || (! SDB_CONST_OBJ(host)->name))
+ if (! name)
return -1;
- cname = sdb_plugin_cname(strdup(SDB_CONST_OBJ(host)->name));
+ cname = sdb_plugin_cname(strdup(name));
if (! cname) {
sdb_log(SDB_LOG_ERR, "store: strdup failed");
return -1;
}
- last_update = host->_last_update;
+ last_update = last_update;
if (last_update <= 0)
last_update = sdb_gettime();
}
}
else {
- sdb_host_t *new = SDB_HOST(sdb_object_clone(SDB_CONST_OBJ(host)));
+ sdb_host_t *new = SDB_HOST(sdb_object_create(name, sdb_host_type));
if (! new) {
char errbuf[1024];
sdb_log(SDB_LOG_ERR, "store: Failed to clone host object: %s",
return status;
} /* sdb_store_host */
-const sdb_host_t *
-sdb_store_get_host(const char *name)
+_Bool
+sdb_store_has_host(const char *name)
{
sdb_host_t *host;
return NULL;
host = SDB_HOST(sdb_llist_search_by_name(host_list, name));
- if (! host)
- return NULL;
- return host;
-} /* sdb_store_get_host */
+ return host != NULL;
+} /* sdb_store_has_host */
sdb_attribute_t *
sdb_attribute_create(const char *hostname,