X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fcore%2Fstore.c;h=b96ff4e9054e46b76c45cc14be00d71e3966e62c;hb=9a0ead9da5ec1bcebf4d8ef236a7ed661729aaa3;hp=a5f712ef72729636b1a4f9a3606bfc9b44b0a15a;hpb=85d24495a23b26c7a1af8f21a122dc304a70f54b;p=sysdb.git diff --git a/src/core/store.c b/src/core/store.c index a5f712e..b96ff4e 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -143,8 +143,8 @@ sdb_attr_clone(const sdb_object_t *obj) const sdb_attribute_t *attr = (const sdb_attribute_t *)obj; sdb_attribute_t *new; - new = sdb_attribute_create(attr->hostname, - obj->name, attr->attr_value); + new = SDB_ATTR(sdb_object_create(obj->name, sdb_attribute_type, + attr->hostname, attr->attr_value)); if (! new) return NULL; @@ -181,7 +181,8 @@ sdb_svc_clone(const sdb_object_t *obj) const sdb_service_t *svc = (const sdb_service_t *)obj; sdb_service_t *new; - new = sdb_service_create(svc->hostname, obj->name); + new = SDB_SVC(sdb_object_create(obj->name, sdb_service_type, + svc->hostname)); if (! new) return NULL; @@ -310,8 +311,8 @@ sdb_store_host(const char *name, sdb_time_t last_update) 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; @@ -319,25 +320,8 @@ sdb_store_get_host(const char *name) return NULL; host = SDB_HOST(sdb_llist_search_by_name(host_list, name)); - if (! host) - return NULL; - return host; -} /* sdb_store_get_host */ - -sdb_attribute_t * -sdb_attribute_create(const char *hostname, - const char *name, const char *value) -{ - sdb_object_t *obj; - - if ((! hostname) || (! name) || (! value)) - return NULL; - - obj = sdb_object_create(name, sdb_attribute_type, hostname, value); - if (! obj) - return NULL; - return SDB_ATTR(obj); -} /* sdb_attribute_create */ + return host != NULL; +} /* sdb_store_has_host */ int sdb_store_attribute(const sdb_attribute_t *attr) @@ -401,20 +385,6 @@ sdb_store_attribute(const sdb_attribute_t *attr) return status; } /* sdb_store_attribute */ -sdb_service_t * -sdb_service_create(const char *hostname, const char *name) -{ - sdb_object_t *obj; - - if ((! hostname) || (! name)) - return NULL; - - obj = sdb_object_create(name, sdb_service_type, hostname); - if (! obj) - return NULL; - return SDB_SVC(obj); -} /* sdb_service_create */ - int sdb_store_service(const sdb_service_t *svc) { @@ -477,20 +447,6 @@ sdb_store_service(const sdb_service_t *svc) return status; } /* sdb_store_service */ -const sdb_service_t * -sdb_store_get_service(const sdb_host_t *host, const char *name) -{ - sdb_service_t *svc; - - if ((! host) || (! name)) - return NULL; - - svc = SDB_SVC(sdb_llist_search_by_name(host->services, name)); - if (! svc) - return NULL; - return svc; -} /* sdb_store_get_service */ - int sdb_store_dump(FILE *fh) {