]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - blob.c
com_check(): Implement mood checking.
[paraslash.git] / blob.c
diff --git a/blob.c b/blob.c
index 0980aad5c14838b61a45e87db5958b9c7b560d75..74b1c4f5a3bbe8cec2d6df5ebcac477025bb9c18 100644 (file)
--- a/blob.c
+++ b/blob.c
@@ -440,6 +440,25 @@ static int blob_get_name_by_id(struct osl_table *table, uint32_t id,
                return blob_get_name_by_id(table_name ## _table, id, name); \
        }
 
+static int blob_get_name_and_def_by_row(struct osl_table *table,
+               const struct osl_row *row, char **name, struct osl_object *def)
+{
+       struct osl_object obj;
+       int ret = osl_get_object(table, row, BLOBCOL_NAME, &obj);
+       if (ret < 0)
+               return ret;
+       *name = obj.data;
+       return osl_open_disk_object(table, row, BLOBCOL_DEF, def);
+}
+/** Define the \p get_name_and_def_by_row function for this blob type. */
+#define DEFINE_GET_NAME_AND_DEF_BY_ROW(table_name, cmd_prefix) \
+       int cmd_prefix ## _get_name_and_def_by_row(const struct osl_row *row, \
+               char **name, struct osl_object *def) \
+       { \
+               return blob_get_name_and_def_by_row(table_name ## _table, \
+                       row, name, def); \
+       }
+
 /** Define the \p shutdown function for this blob type. */
 #define DEFINE_BLOB_SHUTDOWN(table_name) \
        void table_name ## _shutdown(enum osl_close_flags flags) \
@@ -481,6 +500,7 @@ static int blob_init(struct osl_table **table,
        DEFINE_BLOB_COMMAND(rm, table_name, cmd_prefix) \
        DEFINE_BLOB_COMMAND(mv, table_name, cmd_prefix) \
        DEFINE_GET_NAME_BY_ID(table_name, cmd_prefix); \
+       DEFINE_GET_NAME_AND_DEF_BY_ROW(table_name, cmd_prefix); \
        DEFINE_BLOB_SHUTDOWN(table_name); \
        DEFINE_BLOB_INIT(table_name);