diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-01-31 16:50:03 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-01-31 16:50:03 -0800 |
commit | 0c9e398bef070e2841e275ce871fc1836e104711 (patch) | |
tree | 3b1025f7454b3126fcf7e4ad5196291d7d180b4b /highlight.cpp | |
parent | af2d348543f623e30376c54908cfd2eda99fb685 (diff) |
Change parser_t::parse_job's args array to be a local, rather than just leak it, which no longer seems to crash
Diffstat (limited to 'highlight.cpp')
-rw-r--r-- | highlight.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/highlight.cpp b/highlight.cpp index 45632883..7c680475 100644 --- a/highlight.cpp +++ b/highlight.cpp @@ -605,16 +605,13 @@ void tokenize( const wchar_t * const buff, int * const color, const int pos, arr if( cmd == L"cd" ) { - wcstring dir_str = tok_last( &tok ); - if (expand_one(dir_str, EXPAND_SKIP_CMDSUBST)) + wcstring dir = tok_last( &tok ); + if (expand_one(dir, EXPAND_SKIP_CMDSUBST)) { - const wchar_t *dir = dir_str.c_str(); - int is_long_help = wcsncmp(dir,L"--help", wcslen(dir) ); - int is_short_help = wcsncmp(dir,L"-h", wcslen(dir) ); - - if( !is_long_help && !is_short_help && !path_get_cdpath( context, dir ) ) + int is_help = string_prefixes_string(dir, L"--help") || string_prefixes_string(dir, L"-h"); + if( !is_help && ! path_can_get_cdpath(dir)) { - color[ tok_get_pos( &tok ) ] = HIGHLIGHT_ERROR; + color[ tok_get_pos( &tok ) ] = HIGHLIGHT_ERROR; } } } |