diff --git a/complete.h b/complete.h index 1cfeac288..cb7c2e28e 100644 --- a/complete.h +++ b/complete.h @@ -127,9 +127,7 @@ struct completion_t */ int flags; - completion_t () { - flags = 0; - } + completion_t() : flags(0) { } bool operator < (const completion_t& rhs) const { return this->completion < rhs.completion; } bool operator == (const completion_t& rhs) const { return this->completion == rhs.completion; } diff --git a/expand.cpp b/expand.cpp index 2f8924659..596fceeb8 100644 --- a/expand.cpp +++ b/expand.cpp @@ -1860,6 +1860,7 @@ static int expand_cmdsubst2( parser_t &parser, const wcstring &input, std::vecto /** Wrapper around unescape funtion. Issues an error() on failiure. */ +__attribute__((unused)) static wchar_t *expand_unescape( parser_t &parser, const wchar_t * in, int escape_special ) { wchar_t *res = unescape( in, escape_special ); diff --git a/parser.cpp b/parser.cpp index 59c5f53b8..22ce818c2 100644 --- a/parser.cpp +++ b/parser.cpp @@ -1615,8 +1615,7 @@ int parser_t::parse_job( process_t *p, job_t *j, tokenizer *tok ) { -// array_list_t *args = al_halloc( j ); // The list that will become the argc array for the program - std::vector args; + std::vector args; // The list that will become the argc array for the program int use_function = 1; // May functions be considered when checking what action this command represents int use_builtin = 1; // May builtins be considered when checking what action this command represents int use_command = 1; // May commands be considered when checking what action this command represents diff --git a/reader.cpp b/reader.cpp index a04fb9ac0..4a6d8f7ad 100644 --- a/reader.cpp +++ b/reader.cpp @@ -1157,7 +1157,6 @@ static void completion_insert( const wchar_t *val, int flags ) static void run_pager( wchar_t *prefix, int is_quoted, const std::vector &comp ) { - int i; string_buffer_t cmd; string_buffer_t msg; wchar_t * prefix_esc; @@ -1190,13 +1189,13 @@ static void run_pager( wchar_t *prefix, int is_quoted, const std::vector &comp ) { - int i; void *context = 0; wchar_t *base = 0; int len = 0; @@ -1451,7 +1449,7 @@ static int handle_completions( std::vector &comp ) /* Try to find something to insert whith the correct case */ - for( i=0; i< comp.size() ; i++ ) + for( size_t i=0; i< comp.size() ; i++ ) { const completion_t &c = comp.at( i ); int new_len; @@ -1506,7 +1504,7 @@ static int handle_completions( std::vector &comp ) count = 0; - for( i=0; i< comp.size(); i++ ) + for( size_t i=0; i< comp.size(); i++ ) { const completion_t &c = comp.at( i ); int new_len; @@ -2421,6 +2419,7 @@ public: } }; +__attribute__((unused)) static void highlight_complete2( wchar_t *command, const int *colors, int position, void *ctx_ptr ) { background_highlight_context *ctx = (background_highlight_context *)ctx_ptr; if (ctx->buff == data->buff) { diff --git a/util.cpp b/util.cpp index ef0b3cd1e..ee6445137 100644 --- a/util.cpp +++ b/util.cpp @@ -646,52 +646,6 @@ int al_push_all( array_list_t *a, array_list_t *b ) return 1; } -int al_insert( array_list_t *a, int pos, int count ) -{ - - assert( pos >= 0 ); - assert( count >= 0 ); - assert( a ); - - if( !count ) - return 0; - - /* - Reallocate, if needed - */ - if( maxi( pos, a->pos) + count > a->size ) - { - /* - If we reallocate, add a few extra elements just in case we - want to do some more reallocating any time soon - */ - size_t new_size = maxi( maxi( pos, a->pos ) + count +32, a->size*2); - void *tmp = realloc( a->arr, sizeof( anything_t )*new_size ); - if( tmp ) - { - a->arr = (anything_t *)tmp; - } - else - { - oom_handler( a ); - return 0; - } - - } - - if( a->pos > pos ) - { - memmove( &a->arr[pos], - &a->arr[pos+count], - sizeof(anything_t ) * (a->pos-pos) ); - } - - memset( &a->arr[pos], 0, sizeof(anything_t)*count ); - a->pos += count; - - return 1; -} - /** Real implementation of all al_set_* versions. Sets arbitrary element of list. @@ -868,7 +822,7 @@ int al_get_count( array_list_t *l ) void al_foreach( array_list_t *l, void (*func)( void * )) { - int i; + size_t i; CHECK( l, ); CHECK( func, ); @@ -879,7 +833,7 @@ void al_foreach( array_list_t *l, void (*func)( void * )) void al_foreach2( array_list_t *l, void (*func)( void *, void *), void *aux) { - int i; + size_t i; CHECK( l, ); CHECK( func, ); diff --git a/util.h b/util.h index e6dc82b10..2ca5431d1 100644 --- a/util.h +++ b/util.h @@ -361,10 +361,6 @@ int al_push_func( array_list_t *l, func_ptr_t f ); */ int al_push_all( array_list_t *a, array_list_t *b ); -/** - Insert the specified number of new empty positions at the specified position in the list. - */ -int al_insert( array_list_t *a, int pos, int count ); /** Sets the element at the specified index diff --git a/wildcard.cpp b/wildcard.cpp index 1d250176a..50610f80a 100644 --- a/wildcard.cpp +++ b/wildcard.cpp @@ -105,28 +105,6 @@ wildcards using **. /** Hashtable containing all descriptions that describe an executable */ static hash_table_t *suffix_hash=0; -/** - Push the specified argument to the list if an identical string is - not already in the list. This function iterates over the list, - which is quite slow if the list is large. It might make sense to - use a hashtable for this. -*/ -static void al_push_check( array_list_t *l, const wchar_t *newv ) -{ - int i; - - for( i = 0; i < al_get_count(l); i++ ) - { - if( !wcscmp( (const wchar_t *)al_get(l, i), newv ) ) - { - free( (void *)newv ); - return; - } - } - - al_push( l, newv ); -} - /** Free hash key and hash value @@ -1160,14 +1138,13 @@ int wildcard_expand( const wchar_t *wc, int flags, std::vector &out ) { - int c = out.size(); + size_t c = out.size(); int res = wildcard_expand_internal( wc, base_dir, flags, out ); - int i; if( flags & ACCEPT_INCOMPLETE ) { - wchar_t *wc_base=L""; - wchar_t *wc_base_ptr = const_cast(wcsrchr( wc, L'/' )); + const wchar_t *wc_base=L""; + const wchar_t *wc_base_ptr = wcsrchr( wc, L'/' ); string_buffer_t sb; @@ -1178,7 +1155,7 @@ int wildcard_expand( const wchar_t *wc, sb_init( &sb ); - for( i=c; i