Clean up how a view's base table is defined

New struct empfile member base replaces ef_open_view() parameter base.
Cleaner, because the base table is a property of the view, not of how
it's used.

Use it to clean up verify_fail()'s base table access, and for extra
sanity checks in ef_open() and ef_open_view().
This commit is contained in:
Markus Armbruster 2011-05-01 13:59:17 +02:00
parent 2b0b53992f
commit 44f97c3297
5 changed files with 56 additions and 50 deletions

View file

@ -48,14 +48,11 @@ static void verify_fail(int, int, struct castr *, int, char *, ...)
static void
verify_fail(int type, int row, struct castr *ca, int idx, char *fmt, ...)
{
int i;
int base = empfile[type].base < 0 ? type : empfile[type].base;
va_list ap;
/* Find base table of view, if any */
for (i = 0; empfile[i].cache == empfile[type].cache; i++) ;
fprintf(stderr, "%s %s uid %d",
EF_IS_GAME_STATE(i) ? "File" : "Config",
EF_IS_GAME_STATE(base) ? "File" : "Config",
ef_nameof(type), row);
if (ca) {
fprintf(stderr, " field %s", ca->ca_name);