From: Sebastian Harl Date: Sat, 23 Mar 2013 03:48:20 +0000 (-0700) Subject: store: Removed the store specific clone callbacks. X-Git-Tag: sysdb-0.1.0~413 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=913af5b7bc6dc8f05ba13464b0f7e523ebb9a082;p=sysdb.git store: Removed the store specific clone callbacks. … in favor of sdb_object_clone(). --- diff --git a/src/core/store.c b/src/core/store.c index 7af662f..4e6eb48 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -283,12 +283,6 @@ sdb_host_create(const char *name) return SDB_HOST(obj); } /* sdb_host_create */ -sdb_host_t * -sdb_host_clone(const sdb_host_t *host) -{ - return SDB_HOST(sdb_host_do_clone((const sdb_object_t *)host)); -} /* sdb_host_clone */ - int sdb_store_host(const sdb_host_t *host) { @@ -332,7 +326,7 @@ sdb_store_host(const sdb_host_t *host) } } else { - sdb_host_t *new = sdb_host_clone(host); + sdb_host_t *new = SDB_HOST(sdb_host_do_clone(SDB_CONST_OBJ(host))); if (! new) { char errbuf[1024]; sdb_log(SDB_LOG_ERR, "store: Failed to clone host object: %s", @@ -409,12 +403,6 @@ sdb_attribute_create(const char *hostname, return SDB_ATTR(obj); } /* sdb_attribute_create */ -sdb_attribute_t * -sdb_attribute_clone(const sdb_attribute_t *attr) -{ - return SDB_ATTR(sdb_attr_clone((const sdb_object_t *)attr)); -} /* sdb_attribute_clone */ - int sdb_store_attribute(const sdb_attribute_t *attr) { @@ -466,7 +454,7 @@ sdb_store_attribute(const sdb_attribute_t *attr) } } else { - sdb_attribute_t *new = sdb_attribute_clone(attr); + sdb_attribute_t *new = SDB_ATTR(sdb_attr_clone(SDB_CONST_OBJ(attr))); if (! new) { char errbuf[1024]; sdb_log(SDB_LOG_ERR, "store: Failed to clone attribute " @@ -500,12 +488,6 @@ sdb_service_create(const char *hostname, const char *name) return SDB_SVC(obj); } /* sdb_service_create */ -sdb_service_t * -sdb_service_clone(const sdb_service_t *svc) -{ - return SDB_SVC(sdb_svc_clone((const sdb_object_t *)svc)); -} /* sdb_service_clone */ - int sdb_store_service(const sdb_service_t *svc) { @@ -556,7 +538,7 @@ sdb_store_service(const sdb_service_t *svc) } } else { - sdb_service_t *new = sdb_service_clone(svc); + sdb_service_t *new = SDB_SVC(sdb_svc_clone(SDB_CONST_OBJ(svc))); if (! new) { char errbuf[1024]; sdb_log(SDB_LOG_ERR, "store: Failed to clone service " diff --git a/src/include/core/object.h b/src/include/core/object.h index dce562c..b75f3fc 100644 --- a/src/include/core/object.h +++ b/src/include/core/object.h @@ -63,7 +63,9 @@ typedef struct { } sdb_object_wrapper_t; #define SDB_OBJ(obj) ((sdb_object_t *)(obj)) +#define SDB_CONST_OBJ(obj) ((const sdb_object_t *)(obj)) #define SDB_OBJ_WRAPPER(obj) ((sdb_object_wrapper_t *)(obj)) +#define SDB_CONST_OBJ_WRAPPER(obj) ((const sdb_object_wrapper_t *)(obj)) /* * sdb_object_create: diff --git a/src/include/core/store.h b/src/include/core/store.h index 46cd536..7e9c0de 100644 --- a/src/include/core/store.h +++ b/src/include/core/store.h @@ -47,6 +47,7 @@ typedef struct { } sdb_store_obj_t; #define SDB_STORE_OBJ_INIT { SDB_OBJECT_INIT, 0, NULL } #define SDB_STORE_OBJ(obj) ((sdb_store_obj_t *)(obj)) +#define SDB_CONST_STORE_OBJ(obj) ((const sdb_store_obj_t *)(obj)) typedef struct { sdb_store_obj_t parent; @@ -55,6 +56,7 @@ typedef struct { } sdb_service_t; #define SDB_SVC_INIT { SDB_STORE_OBJ_INIT, NULL } #define SDB_SVC(obj) ((sdb_service_t *)(obj)) +#define SDB_CONST_SVC(obj) ((const sdb_service_t *)(obj)) typedef struct { sdb_store_obj_t parent; @@ -64,6 +66,7 @@ typedef struct { } sdb_attribute_t; #define SDB_ATTR_INIT { SDB_STORE_OBJ_INIT, NULL, NULL } #define SDB_ATTR(obj) ((sdb_attribute_t *)(obj)) +#define SDB_CONST_ATTR(obj) ((const sdb_attribute_t *)(obj)) typedef struct { sdb_store_obj_t parent; @@ -73,6 +76,7 @@ typedef struct { } sdb_host_t; #define SDB_HOST_INIT { SDB_STORE_OBJ_INIT, NULL, NULL } #define SDB_HOST(obj) ((sdb_host_t *)(obj)) +#define SDB_CONST_HOST(obj) ((const sdb_host_t *)(obj)) /* shortcuts for accessing the sdb_store_obj_t attributes of inheriting * objects */ @@ -82,9 +86,6 @@ typedef struct { sdb_host_t * sdb_host_create(const char *name); -sdb_host_t * -sdb_host_clone(const sdb_host_t *host); - /* * sdb_store_host: * Add/update a host in the store. If the host, identified by its name, @@ -109,9 +110,6 @@ sdb_attribute_t * sdb_attribute_create(const char *hostname, const char *name, const char *value); -sdb_attribute_t * -sdb_attribute_clone(const sdb_attribute_t *attr); - /* * sdb_store_attribute: * Add/update a host's attribute in the store. If the attribute, identified by @@ -134,9 +132,6 @@ sdb_store_attribute(const sdb_attribute_t *attr); sdb_service_t * sdb_service_create(const char *hostname, const char *name); -sdb_service_t * -sdb_service_clone(const sdb_service_t *svc); - /* * sdb_store_service: * Add/update a store in the store. If the service, identified by its name,