don't include indices for prefixes that don't exist.

This commit is contained in:
Eric House 2011-10-26 22:25:21 -07:00
parent 412a58f6b9
commit 42d1a48a1d

View file

@ -862,9 +862,7 @@ indexOne( const DictionaryCtxt* dict, XP_U16 depth, Tile* tiles,
XWStreamCtxt* stream, EdgeArray* prevEdges, DictIndex* prevIndex )
{
EdgeArray curEdges = { .nEdges = 0 };
if ( !findStartsWith( dict, tiles, depth, &curEdges ) ) {
indices[(*nextIndex)++] = NO_INDEX;
} else {
if ( findStartsWith( dict, tiles, depth, &curEdges ) ) {
XP_ASSERT( curEdges.nEdges == depth );
if ( ! ISACCEPTING( dict, curEdges.edges[curEdges.nEdges-1] ) ) {
if ( !nextWord( dict, &curEdges ) ) {
@ -883,16 +881,15 @@ indexOne( const DictionaryCtxt* dict, XP_U16 depth, Tile* tiles,
}
}
indices[(*nextIndex)++] = *prevIndex;
if ( NULL != stream ) {
XP_UCHAR prefix[8];
(void)dict_tilesToString( dict, tiles, depth, prefix, VSIZE(prefix) );
stream_catString( stream, prefix );
}
}
if ( NULL != stream ) {
stream_catString( stream, "\n" );
}
}
}
static void
doOneDepth( const DictionaryCtxt* dict,