aboutsummaryrefslogtreecommitdiffhomepage
path: root/highlight.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'highlight.cpp')
-rw-r--r--highlight.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/highlight.cpp b/highlight.cpp
index f0fbacea..8f7cbf88 100644
--- a/highlight.cpp
+++ b/highlight.cpp
@@ -605,11 +605,10 @@ void tokenize( const wchar_t * const buff, int * const color, const int pos, arr
if( cmd && (wcscmp( cmd, L"cd" ) == 0) )
{
- wchar_t *dir = expand_one( context,
- wcsdup(tok_last( &tok )),
- EXPAND_SKIP_CMDSUBST );
- if( dir )
+ wcstring dir_str = tok_last( &tok );
+ if (expand_one(dir_str, 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) );