Fix occasional shoowing of the same completion twice. Than ks to Tassilo Horn for the bug report.

darcs-hash:20070317231623-ac50b-a9447aa60d0ca654713a5391a3f6137d29d98916.gz
This commit is contained in:
axel 2007-03-18 09:16:23 +10:00
parent 3e1b0e587e
commit 1e524fbc7a

View file

@ -498,10 +498,14 @@ static void remove_duplicates( array_list_t *l )
{
int in, out;
const wchar_t *prev;
completion_t *first;
if( al_get_count( l ) == 0 )
return;
prev = (wchar_t *)al_get( l, 0 );
first = (completion_t *)al_get( l, 0 );
prev = first->completion;
for( in=1, out=1; in < al_get_count( l ); in++ )
{
completion_t *curr = (completion_t *)al_get( l, in );
@ -509,8 +513,8 @@ static void remove_duplicates( array_list_t *l )
if( wcscmp( prev, curr->completion )!=0 )
{
al_set( l, out++, curr );
prev = curr->completion;
}
prev = curr->completion;
}
al_truncate( l, out );
}