aboutsummaryrefslogtreecommitdiffhomepage
path: root/highlight.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-31 21:30:09 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-01-31 21:30:09 -0800
commit0b4b6c498d4cac8591dcfc04549acd62305d5008 (patch)
treea8bd71ef0b36a1f265922b98e9e5292b8561d2a4 /highlight.cpp
parent409f70c7f3836457cb39113aec36e2c0622e0a61 (diff)
Migrated off of old variant of expand_one that used halloc
Diffstat (limited to 'highlight.cpp')
-rw-r--r--highlight.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/highlight.cpp b/highlight.cpp
index 5b023823..5d6173b5 100644
--- a/highlight.cpp
+++ b/highlight.cpp
@@ -772,7 +772,8 @@ void tokenize( const wchar_t * const buff, int * const color, const int pos, arr
break;
}
- wchar_t *target=0;
+ wcstring target_str;
+ const wchar_t *target=NULL;
color[ tok_get_pos( &tok ) ] = HIGHLIGHT_REDIRECTION;
tok_next( &tok );
@@ -785,7 +786,10 @@ void tokenize( const wchar_t * const buff, int * const color, const int pos, arr
{
case TOK_STRING:
{
- target = expand_one( context, wcsdup( tok_last( &tok ) ), EXPAND_SKIP_CMDSUBST);
+ target_str = tok_last( &tok );
+ if (expand_one(target_str, EXPAND_SKIP_CMDSUBST)) {
+ target = target_str.c_str();
+ }
/*
Redirect filename may contain a cmdsubst.
If so, it will be ignored/not flagged.