top: provided for nls table integrity validation

This commit is contained in:
Jim Warner 2011-10-28 20:38:08 -05:00 committed by Craig Small
parent 3d1f469995
commit acd73a1365
2 changed files with 28 additions and 0 deletions

View File

@ -41,6 +41,7 @@
//#define TREE_NORESET /* sort keys do NOT force forest view OFF */ //#define TREE_NORESET /* sort keys do NOT force forest view OFF */
//#define TREE_ONEPASS /* for speed, tolerate dangling children */ //#define TREE_ONEPASS /* for speed, tolerate dangling children */
//#define USE_X_COLHDR /* emphasize header vs. whole col, for 'x' */ //#define USE_X_COLHDR /* emphasize header vs. whole col, for 'x' */
//#define VALIDATE_NLS /* validate integrity of all 3 nls tables */
/*###### Notes, etc. ###################################################*/ /*###### Notes, etc. ###################################################*/

View File

@ -589,7 +589,34 @@ static void build_uniq_nsltab (void) {
/* /*
* Duh... */ * Duh... */
void initialize_nsl (void) { void initialize_nsl (void) {
#ifdef VALIDATE_NLS
static const char *nls_err ="\t%s_nlstab[%d] == NULL\n";
int i;
memset(Desc_nlstab, 0, sizeof(Desc_nlstab));
build_desc_nlstab();
for (i = 0; i < P_MAXPFLGS; i++)
if (!Desc_nlstab[i]) {
fprintf(stderr, nls_err, "Desc", i);
exit(1);
}
memset(Norm_nlstab, 0, sizeof(Norm_nlstab));
build_norm_nlstab();
for (i = 0; i < norm_MAX; i++)
if (!Norm_nlstab[i]) {
fprintf(stderr, nls_err, "Norm", i);
exit(1);
}
memset(Uniq_nlstab, 0, sizeof(Uniq_nlstab));
build_uniq_nsltab();
for (i = 0; i < uniq_MAX; i++)
if (!Uniq_nlstab[i]) {
fprintf(stderr, nls_err, "Uniq", i);
exit(1);
}
#else
build_desc_nlstab(); build_desc_nlstab();
build_norm_nlstab(); build_norm_nlstab();
build_uniq_nsltab(); build_uniq_nsltab();
#endif
} }