Code

store_json: Let the formatter implement the store-writer interface.
[sysdb.git] / src / include / core / object.h
index 42352b085876b48cbbaca7716670d05c4bc06d14..19d6cc33799c68eeefa3a7e72f322fdf2522201c 100644 (file)
@@ -57,6 +57,10 @@ struct sdb_object {
 #define SDB_OBJECT_INIT { SDB_TYPE_INIT, 1, NULL }
 #define SDB_OBJECT_TYPED_INIT(t) { (t), 1, NULL }
 
+#define SDB_OBJECT_STATIC(name) { \
+       /* type */ { sizeof(sdb_object_t), NULL, NULL }, \
+       /* ref-cnt */ 1, (name) }
+
 typedef struct {
        sdb_object_t super;
        void *data;
@@ -70,6 +74,11 @@ typedef struct {
 
 /*
  * Callback types for comparing objects or performing object lookup.
+ * Any function of type sdb_object_cmp_cb shall return a negative value, zero,
+ * or a positive value if the first object compares less than, equal to, or
+ * greater than the second object respectively.
+ * Any function of type sdb_object_lookup_cb shall return zero for all
+ * matching objects.
  */
 typedef int (*sdb_object_cmp_cb)(const sdb_object_t *, const sdb_object_t *);
 typedef int (*sdb_object_lookup_cb)(const sdb_object_t *, const void *user_data);
@@ -133,8 +142,8 @@ sdb_object_t *
 sdb_object_create_wrapper(const char *name,
                void *data, void (*destructor)(void *));
 
-#define SDB_OBJECT_WRAPPER_STATIC(obj, destructor) \
-       { SDB_OBJECT_INIT, (obj), (destructor) }
+#define SDB_OBJECT_WRAPPER_STATIC(obj) \
+       { SDB_OBJECT_INIT, (obj), /* destructor */ NULL }
 
 /*
  * sdb_object_deref: