diff --git a/builtin_complete.cpp b/builtin_complete.cpp index 49e09f91c..79678a97a 100644 --- a/builtin_complete.cpp +++ b/builtin_complete.cpp @@ -45,15 +45,15 @@ static const wchar_t *temporary_buffer; static void builtin_complete_add2( const wchar_t *cmd, int cmd_type, const wchar_t *short_opt, - array_list_t *gnu_opt, - array_list_t *old_opt, + const wcstring_list_t &gnu_opt, + const wcstring_list_t &old_opt, int result_mode, const wchar_t *condition, const wchar_t *comp, const wchar_t *desc, int flags ) { - int i; + size_t i; const wchar_t *s; for( s=short_opt; *s; s++ ) @@ -70,12 +70,12 @@ static void builtin_complete_add2( const wchar_t *cmd, flags ); } - for( i=0; i *outputs; -public: - wchar_t *str; - array_list_t lst; - - wcstring_adapter(const wcstring &in, std::vector &outs) - { - outputs = &outs; - str = wcsdup(in.c_str()); - al_init(&lst); - } - - ~wcstring_adapter() - { - int i, max = al_get_count(&lst); - for (i=0; i < max; i++) { - wchar_t *tmp = (wchar_t *)al_get(&lst, i); - outputs->push_back(tmp); - free(tmp); - } - al_destroy(&lst); - //str is free'd by the function we called - } -}; - int expand_is_clean( const wchar_t *in ) { @@ -688,13 +659,6 @@ static int expand_pid( const wcstring &instr, return 1; } -/* -static int expand_pid2( const wcstring &in, int flags, std::vector &outputs ) -{ - wcstring_adapter adapter(in, outputs); - return expand_pid(adapter.str, flags, &adapter.lst); -} -*/ void expand_variable_error( parser_t &parser, const wchar_t *token, int token_pos, int error_pos ) { @@ -1194,13 +1158,6 @@ static int expand_brackets(parser_t &parser, const wchar_t *in, int flags, std:: return 1; } -/* -static int expand_brackets2( parser_t &parser, const wcstring &in, int flags, std::vector &outputs ) -{ - wcstring_adapter adapter(in, outputs); - return expand_brackets(parser, adapter.str, flags, &adapter.lst); -} -*/ /** Perform cmdsubst expansion */ diff --git a/fish_tests.cpp b/fish_tests.cpp index e329120fe..95ce0d318 100644 --- a/fish_tests.cpp +++ b/fish_tests.cpp @@ -108,53 +108,6 @@ static void err( const wchar_t *blah, ... ) wprintf( L"\n" ); } - -/** - Test stack functionality -*/ -static int stack_test( int elements ) -{ - long i; - - int res=1; - - array_list_t s; - - al_init( &s ); - - for( i=0; i lst; int level=0; wchar_t prev_q=0; @@ -1066,7 +1064,7 @@ static void highlight_universal_internal( const wchar_t * buff, if( level == 0 ) { level++; - al_push_long( &l, (long)(str-buff) ); + lst.push_back((long)(str-buff)); prev_q = *str; } else @@ -1076,7 +1074,7 @@ static void highlight_universal_internal( const wchar_t * buff, long pos1, pos2; level--; - pos1 = al_pop_long( &l ); + pos1 = lst.back(); pos2 = str-buff; if( pos1==pos || pos2==pos ) { @@ -1090,7 +1088,7 @@ static void highlight_universal_internal( const wchar_t * buff, else { level++; - al_push_long( &l, (long)(str-buff) ); + lst.push_back((long)(str-buff)); prev_q = *str; } } @@ -1102,8 +1100,6 @@ static void highlight_universal_internal( const wchar_t * buff, str++; } - - al_destroy( &l ); if( !match_found ) color[pos] = HIGHLIGHT_ERROR<<16;