diff options
author | Peter Ammon <corydoras@ridiculousfish.com> | 2012-01-14 22:32:45 -0800 |
---|---|---|
committer | Peter Ammon <corydoras@ridiculousfish.com> | 2012-01-14 22:32:45 -0800 |
commit | 9b133a978d5f33985a9b66d3a75165e3d50cdfa3 (patch) | |
tree | e846e195756904d8c007ae1f33e77a53d696102c /output.cpp | |
parent | 203c749e6cc2d5ac0e9e8e240c77d94e179c60d0 (diff) |
Improve const and signed/unsigned correctness
Diffstat (limited to 'output.cpp')
-rw-r--r-- | output.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -382,7 +382,7 @@ int writembs_internal( char *str ) int writech( wint_t ch ) { mbstate_t state; - int i; + size_t i; char buff[MB_LEN_MAX+1]; size_t bytes; @@ -548,20 +548,20 @@ int write_escaped_str( const wchar_t *str, int max_len ) int output_color_code( const wchar_t *val ) { - int j, i, color=FISH_COLOR_NORMAL; - array_list_t el; + size_t i; + int color=FISH_COLOR_NORMAL; int is_bold=0; int is_underline=0; if( !val ) return FISH_COLOR_NORMAL; - al_init( &el ); - tokenize_variable_array( val, &el ); + wcstring_list_t el; + tokenize_variable_array2( val, el ); - for( j=0; j<al_get_count( &el ); j++ ) + for(size_t j=0; j < el.size(); j++ ) { - wchar_t *next = (wchar_t *)al_get( &el, j ); + const wchar_t *next = el.at(j).c_str(); is_bold |= (wcsncmp( next, L"--bold", wcslen(next) ) == 0 ) && wcslen(next)>=3; is_bold |= wcscmp( next, L"-o" ) == 0; @@ -580,9 +580,6 @@ int output_color_code( const wchar_t *val ) } - al_foreach( &el, &free ); - al_destroy( &el ); - return color | (is_bold?FISH_COLOR_BOLD:0) | (is_underline?FISH_COLOR_UNDERLINE:0); } |