empdump: Omit redundant data from export, new -c includes it

Cuts size of export files in test suite by a factor of four.  Not a
big deal for disk usage, as export files compress very well, and disk
space is cheap anyway.  Export files are simply easier to work with
when they aren't full of redundant crap.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-02-09 17:48:36 +01:00
parent 7d3a3df283
commit f4f048234c
12 changed files with 43 additions and 42173 deletions

View file

@ -135,6 +135,27 @@ can_fill_gaps(int type)
&& !have_hardcoded_indexes(type);
}
/*
* Is table TYPE's ID-th record OBJ redundant for xundump()
*/
int
xundump_redundant(int type, int id, void *obj)
{
char buf[EF_WITH_CADEF_MAX_ENTRY_SIZE];
if (!can_fill_gaps(type))
return 0;
if (may_truncate(type) && id == ef_nelem(type) - 1)
return 0;
ef_blank(type, id, buf);
if (ef_flags(type) & EFF_TYPED)
return ef_typedstr_eq((struct ef_typedstr *)buf,
(struct ef_typedstr *)obj);
return !memcmp(obj, buf, empfile[type].size);
}
/*
* Gripe about the current line to stderr, return -1.
*/