link-grammar-5.8.0/link-grammar/dict-file/read-dict.c
/**
 * prune_lookup_list -- discard all list entries that don't match string
 * Walk the lookup list (of right links), discarding all nodes that do
 * not match the dictionary string s. The matching is dictionary matching:
 * subscripted entries will match "bare" entries.
 */
- discard all list entries that don't match string
Walk the lookup list (of right links), discarding all nodes that do
not match the dictionary string s. The matching is dictionary matching:
subscripted entries will match "bare" entries.
- discard all list entries that don ' t match string Walk the lookup list ( of right links ) discarding all nodes that do not match the dictionary string s . The matching is dictionary matching : subscripted entries will match " bare " entries .
static Dict_node * prune_lookup_list(Dict_node * restrict llist, const char * restrict s)
{
	Dict_node *dn, *dnx, *list_new;
	list_new = NULL;
	for (dn = llist; dn != NULL; dn = dnx)
	{
		dnx = dn->right;
		if (dict_match(dn->string, s))
		{
			dn->right = list_new;
			list_new = dn;
		}
		else
		{
			free(dn);
		}
	}
	llist = NULL;
	for (dn = list_new; dn != NULL; dn = dnx)
	{
		dnx = dn->right;
		dn->right = llist;
		llist = dn;
	}
	return llist;
}
static Dict_node * prune_lookup_list ( Dict_node * restrict llist , const char * restrict s ) { Dict_node * dn , * dnx , * list_new ; list_new = NULL ; for ( dn = llist ; dn != NULL ; dn = dnx ) { dnx = dn -> right ; if ( dict_match ( dn -> string , s ) ) { dn -> right = list_new ; list_new = dn ; } else { free ( dn ) ; } } llist = NULL ; for ( dn = list_new ; dn != NULL ; dn = dnx ) { dnx = dn -> right ; dn -> right = llist ; llist = dn ; } return llist ; }
prune_lookup_list -- discard all list entries that don't match string
 Walk the lookup list (of right links), discarding all nodes that do
 not match the dictionary string s. The matching is dictionary matching:
 subscripted entries will match "bare" entries.
prune_lookup_list -- discard all list entries that don ' t match string Walk the lookup list ( of right links ) discarding all nodes that do not match the dictionary string s . The matching is dictionary matching : subscripted entries will match " bare " entries .
/* now put dn onto the answer list, or free it */ /* now reverse the list back */