static int dump_db(struct src_head *sh, struct _region *r) { struct _db_factory *df; struct src_entry *se; struct _region subr; void *ptr; size_t size; int ret; ret = _db_factory_create(&df, &_db_hash_std, NULL); if (ret) return (ret); STAILQ_FOREACH(se, sh, se_entry) { size = _db_factory_calc_size(se->se_df); ptr = malloc(size); if (ptr == NULL) goto quit; _region_init(&subr, ptr, size); ret = _db_factory_serialize(se->se_df, _CITRUS_PIVOT_SUB_MAGIC, &subr); if (ret) goto quit; ret = _db_factory_add_by_s(df, se->se_name, &subr, 1); if (ret) goto quit; }
static int dump_db(struct _citrus_db_factory *df, struct _region *r) { void *ptr; size_t size; size = _db_factory_calc_size(df); ptr = malloc(size); if (ptr == NULL) return (errno); _region_init(r, ptr, size); return (_db_factory_serialize(df, _CITRUS_LOOKUP_MAGIC, r)); }