Code

Include config.h in source files.
[sysdb.git] / src / core / object.c
index d6665e7cbd7546645093d0d97c68136dc17ed8a0..9d10f9831720ba8eaf310d3f83227c8572025df1 100644 (file)
  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if HAVE_CONFIG_H
+#      include "config.h"
+#endif /* HAVE_CONFIG_H */
+
 #include "core/object.h"
 
 #include <assert.h>
@@ -66,8 +70,7 @@ static sdb_type_t sdb_object_wrapper_type = {
        sizeof(sdb_object_wrapper_t),
 
        sdb_object_wrapper_init,
-       sdb_object_wrapper_destroy,
-       /* clone = */ NULL
+       sdb_object_wrapper_destroy
 };
 
 /*
@@ -86,6 +89,7 @@ sdb_object_vcreate(const char *name, sdb_type_t type, va_list ap)
        if (! obj)
                return NULL;
        memset(obj, 0, type.size);
+       obj->type = type;
 
        if (name) {
                obj->name = strdup(name);
@@ -104,7 +108,6 @@ sdb_object_vcreate(const char *name, sdb_type_t type, va_list ap)
                }
        }
 
-       obj->type = type;
        obj->ref_cnt = 1;
        return obj;
 } /* sdb_object_vcreate */
@@ -121,6 +124,13 @@ sdb_object_create(const char *name, sdb_type_t type, ...)
        return obj;
 } /* sdb_object_create */
 
+sdb_object_t *
+sdb_object_create_simple(const char *name, size_t size)
+{
+       sdb_type_t t = { size, NULL, NULL };
+       return sdb_object_create(name, t);
+} /* sdb_object_create_simple */
+
 sdb_object_t *
 sdb_object_create_wrapper(const char *name,
                void *data, void (*destructor)(void *))
@@ -155,14 +165,6 @@ sdb_object_ref(sdb_object_t *obj)
        ++obj->ref_cnt;
 } /* sdb_object_ref */
 
-sdb_object_t *
-sdb_object_clone(const sdb_object_t *obj)
-{
-       if ((! obj) || (! obj->type.clone))
-               return NULL;
-       return obj->type.clone(obj);
-} /* sdb_object_clone */
-
 int
 sdb_object_cmp_by_name(const sdb_object_t *o1, const sdb_object_t *o2)
 {