(verify_row): Simplify control structure. No functional change.

This commit is contained in:
Markus Armbruster 2006-02-05 19:55:05 +00:00
parent 2258ec7703
commit afd93afbd3

View file

@ -29,7 +29,6 @@
* *
* Known contributors to this file: * Known contributors to this file:
* Ron Koenderink, 2005 * Ron Koenderink, 2005
*
*/ */
#include <config.h> #include <config.h>
@ -65,7 +64,8 @@ verify_row(int type, int row)
n = ca[i].ca_type != NSC_STRINGY ? ca[i].ca_len : 0; n = ca[i].ca_type != NSC_STRINGY ? ca[i].ca_len : 0;
j = 0; j = 0;
do { do {
if (ca[i].ca_table != EF_BAD && ca[i].ca_table != type) { if (ca[i].ca_table == EF_BAD || ca[i].ca_table == type)
continue;
val.val_type = ca[i].ca_type; val.val_type = ca[i].ca_type;
val.val_cat = NSC_OFF; val.val_cat = NSC_OFF;
val.val_as.sym.off = ca[i].ca_off; val.val_as.sym.off = ca[i].ca_off;
@ -73,9 +73,9 @@ verify_row(int type, int row)
nstr_exec_val(&val, 0, row_ref, NSC_NOTYPE); nstr_exec_val(&val, 0, row_ref, NSC_NOTYPE);
if (val.val_type != NSC_LONG && val.val_type != NSC_TYPEID) if (val.val_type != NSC_LONG && val.val_type != NSC_TYPEID)
continue; continue;
ca_sym = ef_cadef(ca[i].ca_table); ca_sym = ef_cadef(ca[i].ca_table);
if (ca[i].ca_flags & NSC_BITS) { if (ca[i].ca_flags & NSC_BITS) {
/* symbol set */
if (ca_sym != symbol_ca) { if (ca_sym != symbol_ca) {
fprintf(stderr, fprintf(stderr,
"Unable to verify symbol set as the " "Unable to verify symbol set as the "
@ -97,19 +97,8 @@ verify_row(int type, int row)
ret_val = -1; ret_val = -1;
} }
} }
} else { } else if (ca_sym == symbol_ca) {
if (ca_sym != symbol_ca) { /* symbol */
if (val.val_as.lng >= ef_nelem(ca[i].ca_table) ||
val.val_as.lng < -2) {
fprintf(stderr, "Table index %ld to table %s "
"out of range, nelements %d for table %s "
"row %d field %s\n",
val.val_as.lng, ef_nameof(ca[i].ca_table),
ef_nelem(ca[i].ca_table), ef_nameof(type),
row + 1, ca[i].ca_name);
ret_val = -1;
}
} else {
if (val.val_as.lng > -1) { if (val.val_as.lng > -1) {
if (!symbol_by_value(val.val_as.lng, if (!symbol_by_value(val.val_as.lng,
ef_ptr(ca[i].ca_table,0))) { ef_ptr(ca[i].ca_table,0))) {
@ -123,7 +112,17 @@ verify_row(int type, int row)
ret_val = -1; ret_val = -1;
} }
} }
} } else {
/* table index */
if (val.val_as.lng >= ef_nelem(ca[i].ca_table) ||
val.val_as.lng < -2) {
fprintf(stderr, "Table index %ld to table %s "
"out of range, nelements %d for table %s "
"row %d field %s\n",
val.val_as.lng, ef_nameof(ca[i].ca_table),
ef_nelem(ca[i].ca_table), ef_nameof(type),
row + 1, ca[i].ca_name);
ret_val = -1;
} }
} }
} while (++j < n); } while (++j < n);