Don't check values for immutable fields match when initializing an

empty table:
(initialized): New.
(xundump): Set it.
(fldval_must_match): Ignore NSC_CONST when it's clear.
This commit is contained in:
Markus Armbruster 2006-06-04 08:37:37 +00:00
parent b7922c9bd8
commit 8fa0dcbe17

View file

@ -62,6 +62,7 @@
#include "optlist.h" #include "optlist.h"
#include "prototypes.h" #include "prototypes.h"
static unsigned char initialized[EF_MAX];
static char *fname; static char *fname;
static int lineno; static int lineno;
static int human; static int human;
@ -400,7 +401,8 @@ fldval_must_match(int fldno)
struct castr *ca = ef_cadef(cur_type); struct castr *ca = ef_cadef(cur_type);
int i = fldca[fldno] - ca; int i = fldca[fldno] - ca;
return (fldca[fldno]->ca_flags & NSC_CONST) || caseen[i]; return (initialized[cur_type] && (fldca[fldno]->ca_flags & NSC_CONST))
|| caseen[i];
} }
static void * static void *
@ -782,6 +784,7 @@ xundump(FILE *fp, char *file, int expected_table)
lineno++; lineno++;
ungetc(ch, fp); ungetc(ch, fp);
initialized[type] = 1;
return type; return type;
} }