Add supporting uuid function to allocate memory and call id_write_format.
Call id_format_and_copy from _uuid_disp.
{
char *repstr = NULL;
- if (!(repstr = dm_pool_alloc(mem, 40))) {
- log_error("dm_pool_alloc failed");
- return 0;
- }
-
- if (!id_write_format((const struct id *) data, repstr, 40))
+ if (!(repstr = id_format_and_copy(mem, (struct id *)data)))
return_0;
dm_report_field_set_value(field, repstr, NULL);
return id_valid(id);
}
+
+char *id_format_and_copy(struct dm_pool *mem, const struct id *id)
+{
+ char *repstr = NULL;
+
+ if (!(repstr = dm_pool_alloc(mem, 40))) {
+ log_error("dm_pool_alloc failed");
+ return NULL;
+ }
+
+ if (!id_write_format(id, repstr, 40))
+ return_NULL;
+
+ return repstr;
+}
*/
int id_read_format(struct id *id, const char *buffer);
+char *id_format_and_copy(struct dm_pool *mem, const struct id *id);
+
#endif