Code

object: Be more specific about requirements for the 'destroy' callback.
[sysdb.git] / src / include / core / object.h
index 23cd8565d92c0f18ad04d5764750891192bee981..9169c441383b292803a67efc35e91147528aa1e2 100644 (file)
@@ -46,9 +46,8 @@ struct sdb_type {
 
        int (*init)(sdb_object_t *, va_list);
        void (*destroy)(sdb_object_t *);
-       sdb_object_t *(*clone)(const sdb_object_t *);
 };
-#define SDB_TYPE_INIT { 0, NULL, NULL, NULL }
+#define SDB_TYPE_INIT { 0, NULL, NULL }
 
 struct sdb_object {
        sdb_type_t type;
@@ -79,7 +78,9 @@ typedef struct {
  *
  * The init function will be called with the remaining arguments passed to
  * sdb_object_create. If the init function fails (returns a non-zero value),
- * the object will be destructed and destroyed.
+ * the object will be destructed and destroyed. In this case, the 'destroy'
+ * callback may be called on objects that were only half-way initialized. The
+ * callback has to handle that case correctly.
  *
  * The reference count of the new object will be 1.
  *
@@ -123,19 +124,6 @@ sdb_object_deref(sdb_object_t *obj);
 void
 sdb_object_ref(sdb_object_t *obj);
 
-/*
- * sdb_object_clone:
- * Clone an existing object using its type's 'clone' callback. The callback is
- * responsible for correctly initializing a new object (which may be done
- * using the object create function or the object's type's init function).
- *
- * Returns:
- *  - the cloned object on success
- *  - NULL on error or if no clone callback is available
- */
-sdb_object_t *
-sdb_object_clone(const sdb_object_t *obj);
-
 /*
  * sdb_object_cmp_by_name:
  * Compare two objects by their name ignoring the case of the characters.