mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 20:33:08 +00:00
Squash a bunch of warnings
This commit is contained in:
parent
0c9e398bef
commit
4ccc2550d0
7 changed files with 15 additions and 91 deletions
|
@ -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; }
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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<completion_t> args;
|
||||
std::vector<completion_t> 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
|
||||
|
|
11
reader.cpp
11
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<completion_t> &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<complet
|
|||
|
||||
escaped_separator = escape( COMPLETE_SEP_STR, 1);
|
||||
|
||||
for( i=0; i< comp.size(); i++ )
|
||||
for( size_t i=0; i< comp.size(); i++ )
|
||||
{
|
||||
const completion_t &el = comp.at( i );
|
||||
has_case_sensitive |= !(el.flags & COMPLETE_NO_CASE );
|
||||
}
|
||||
|
||||
for( i=0; i< comp.size(); i++ )
|
||||
for( size_t i=0; i< comp.size(); i++ )
|
||||
{
|
||||
|
||||
int base_len=-1;
|
||||
|
@ -1389,7 +1388,6 @@ int reader_can_replace( const wchar_t *in, int flags )
|
|||
|
||||
static int handle_completions( std::vector<completion_t> &comp )
|
||||
{
|
||||
int i;
|
||||
void *context = 0;
|
||||
wchar_t *base = 0;
|
||||
int len = 0;
|
||||
|
@ -1451,7 +1449,7 @@ static int handle_completions( std::vector<completion_t> &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<completion_t> &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) {
|
||||
|
|
50
util.cpp
50
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, );
|
||||
|
|
4
util.h
4
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
|
||||
|
|
33
wildcard.cpp
33
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<completion_t> &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<wchar_t*>(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<out.size(); i++ )
|
||||
for( size_t i=c; i<out.size(); i++ )
|
||||
{
|
||||
completion_t &c = out.at( i );
|
||||
|
||||
|
@ -1195,7 +1172,7 @@ int wildcard_expand( const wchar_t *wc,
|
|||
|
||||
if( wc_base_ptr )
|
||||
{
|
||||
free( wc_base );
|
||||
free( (void *)wc_base );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue