link-grammar-5.8.0/link-grammar/tokenize/wordgraph.c
/**
 * Append a Gword list to a given Gword list (w/o duplicates).
 */
Append a Gword list to a given Gword list (w/o duplicates).
Append a Gword list to a given Gword list ( w / o duplicates ) .
void gwordlist_append_list(const Gword ***to_word, const Gword **from_word)
{
	size_t to_word_arr_len = gwordlist_len(*to_word);
	for (const Gword **f = from_word; NULL != *f; f++)
	{
		size_t l;
		for (l = 0; l < to_word_arr_len; l++)
			if (*f == (*to_word)[l]) break; 
		if (l == to_word_arr_len)
			gwordlist_append((Gword ***)to_word, (Gword *)*f);
	}
}
void gwordlist_append_list ( const Gword * * * to_word , const Gword * * from_word ) { size_t to_word_arr_len = gwordlist_len ( * to_word ) ; for ( const Gword * * f = from_word ; NULL != * f ; f ++ ) { size_t l ; for ( l = 0 ; l < to_word_arr_len ; l ++ ) if ( * f == ( * to_word ) [ l ] ) break ; if ( l == to_word_arr_len ) gwordlist_append ( ( Gword * * * ) to_word , ( Gword * ) * f ) ; } }
Append a Gword list to a given Gword list (w/o duplicates).
Append a Gword list to a given Gword list ( w / o duplicates ) .
/* Note: Must use indexing because to_word may get realloc'ed. */ /* Filter duplicates. */