summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 523a1d3)
raw | patch | inline | side by side (parent: 523a1d3)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 23 Mar 2013 03:48:20 +0000 (20:48 -0700) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sat, 23 Mar 2013 03:48:20 +0000 (20:48 -0700) |
… in favor of sdb_object_clone().
src/core/store.c | patch | blob | history | |
src/include/core/object.h | patch | blob | history | |
src/include/core/store.h | patch | blob | history |
diff --git a/src/core/store.c b/src/core/store.c
index 7af662f8aa66a7ac4e6c7fd8489157c000915b8c..4e6eb4804aad042621dd267f642f4c8a445014b8 100644 (file)
--- a/src/core/store.c
+++ b/src/core/store.c
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)
{
}
}
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",
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)
{
}
}
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 "
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)
{
}
}
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 "
index dce562c42fbb697865a4eab0dc1f5f5ead143b08..b75f3fce4ff3f89042abf9256e6ae6cd30863909 100644 (file)
} 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:
index 46cd53643a7ec8b1d63a5431d4fde5dc3b94c2fb..7e9c0dee21a056ee924d79f0ad8073e0b1418d40 100644 (file)
--- a/src/include/core/store.h
+++ b/src/include/core/store.h
} 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;
} 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;
} 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;
} 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 */
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,
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
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,