(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:
|
* Known contributors to this file:
|
||||||
* Ron Koenderink, 2005
|
* Ron Koenderink, 2005
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -65,66 +64,66 @@ 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)
|
||||||
val.val_type = ca[i].ca_type;
|
continue;
|
||||||
val.val_cat = NSC_OFF;
|
val.val_type = ca[i].ca_type;
|
||||||
val.val_as.sym.off = ca[i].ca_off;
|
val.val_cat = NSC_OFF;
|
||||||
val.val_as.sym.idx = j;
|
val.val_as.sym.off = ca[i].ca_off;
|
||||||
nstr_exec_val(&val, 0, row_ref, NSC_NOTYPE);
|
val.val_as.sym.idx = j;
|
||||||
if (val.val_type != NSC_LONG && val.val_type != NSC_TYPEID)
|
nstr_exec_val(&val, 0, row_ref, NSC_NOTYPE);
|
||||||
continue;
|
if (val.val_type != NSC_LONG && val.val_type != NSC_TYPEID)
|
||||||
|
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) {
|
||||||
if (ca_sym != symbol_ca) {
|
/* symbol set */
|
||||||
fprintf(stderr,
|
if (ca_sym != symbol_ca) {
|
||||||
|
fprintf(stderr,
|
||||||
"Unable to verify symbol set as the "
|
"Unable to verify symbol set as the "
|
||||||
"table %s is not created as symbol table "
|
"table %s is not created as symbol table "
|
||||||
"for table %s row %d field %s\n",
|
"for table %s row %d field %s\n",
|
||||||
ef_nameof(ca[i].ca_table), ef_nameof(type),
|
ef_nameof(ca[i].ca_table), ef_nameof(type),
|
||||||
row + 1, ca[i].ca_name
|
row + 1, ca[i].ca_name
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (k = 0; k < (int)sizeof(long) * 8; k++) {
|
for (k = 0; k < (int)sizeof(long) * 8; k++) {
|
||||||
if (val.val_as.lng & (1L << k))
|
if (val.val_as.lng & (1L << k))
|
||||||
if (!symbol_by_value(1L << k, ef_ptr(ca[i].ca_table, 0))) {
|
if (!symbol_by_value(1L << k, ef_ptr(ca[i].ca_table, 0))) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"bit %d not found in symbol table %s "
|
"bit %d not found in symbol table %s "
|
||||||
"when verify table %s row %d field %s\n",
|
"when verify table %s row %d field %s\n",
|
||||||
k, ef_nameof(ca[i].ca_table),
|
k, ef_nameof(ca[i].ca_table),
|
||||||
ef_nameof(type), row + 1, ca[i].ca_name);
|
ef_nameof(type), row + 1, ca[i].ca_name);
|
||||||
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;
|
ret_val = -1;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if (val.val_as.lng > -1) {
|
} else if (ca_sym == symbol_ca) {
|
||||||
if (!symbol_by_value(val.val_as.lng,
|
/* symbol */
|
||||||
ef_ptr(ca[i].ca_table,0))) {
|
if (val.val_as.lng > -1) {
|
||||||
fprintf(stderr, "value %ld not found in "
|
if (!symbol_by_value(val.val_as.lng,
|
||||||
"symbol table %s when verify table %s "
|
ef_ptr(ca[i].ca_table,0))) {
|
||||||
"row %d field %s\n",
|
fprintf(stderr, "value %ld not found in "
|
||||||
val.val_as.lng,
|
"symbol table %s when verify table %s "
|
||||||
ef_nameof(ca[i].ca_table),
|
"row %d field %s\n",
|
||||||
ef_nameof(type), row + 1,
|
val.val_as.lng,
|
||||||
ca[i].ca_name);
|
ef_nameof(ca[i].ca_table),
|
||||||
ret_val = -1;
|
ef_nameof(type), row + 1,
|
||||||
}
|
ca[i].ca_name);
|
||||||
}
|
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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue