(verify_row): Simplify control structure. No functional change.
This commit is contained in:
parent
2258ec7703
commit
afd93afbd3
1 changed files with 47 additions and 48 deletions
|
@ -29,7 +29,6 @@
|
|||
*
|
||||
* Known contributors to this file:
|
||||
* Ron Koenderink, 2005
|
||||
*
|
||||
*/
|
||||
|
||||
#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;
|
||||
j = 0;
|
||||
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_cat = NSC_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);
|
||||
if (val.val_type != NSC_LONG && val.val_type != NSC_TYPEID)
|
||||
continue;
|
||||
|
||||
ca_sym = ef_cadef(ca[i].ca_table);
|
||||
if (ca[i].ca_flags & NSC_BITS) {
|
||||
/* symbol set */
|
||||
if (ca_sym != symbol_ca) {
|
||||
fprintf(stderr,
|
||||
"Unable to verify symbol set as the "
|
||||
|
@ -97,19 +97,8 @@ verify_row(int type, int row)
|
|||
ret_val = -1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (ca_sym != symbol_ca) {
|
||||
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 {
|
||||
} else if (ca_sym == symbol_ca) {
|
||||
/* symbol */
|
||||
if (val.val_as.lng > -1) {
|
||||
if (!symbol_by_value(val.val_as.lng,
|
||||
ef_ptr(ca[i].ca_table,0))) {
|
||||
|
@ -123,7 +112,17 @@ verify_row(int type, int row)
|
|||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue