From 294fbc830918f49dd13500bdf0fb4f4933338023 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Wed, 9 May 2012 02:55:36 -0700 Subject: [PATCH] Replaced some calls to unescape with unescape_string --- builtin_complete.cpp | 10 ++++------ common.cpp | 2 +- exec.cpp | 2 +- fish_indent.cpp | 13 +++++++------ 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/builtin_complete.cpp b/builtin_complete.cpp index 46c4a9d5a..b08407f48 100644 --- a/builtin_complete.cpp +++ b/builtin_complete.cpp @@ -423,15 +423,13 @@ static int builtin_complete( parser_t &parser, wchar_t **argv ) case 'p': case 'c': { - wchar_t *a = unescape( woptarg, 1); - if( a ) + wcstring tmp = woptarg; + if (unescape_string(tmp, 1)) { if (opt=='p') - path.push_back(a); + path.push_back(tmp); else - cmd.push_back(a); - - free(a); + cmd.push_back(tmp); } else { diff --git a/common.cpp b/common.cpp index b86cca5d1..c283bc7a9 100644 --- a/common.cpp +++ b/common.cpp @@ -496,7 +496,7 @@ const wchar_t *wcsfuncname( const wchar_t *str ) int wcsvarchr( wchar_t chr ) { - return ( (iswalnum(chr)) || (chr == L'_' )); + return iswalnum(chr) || chr == L'_'; } diff --git a/exec.cpp b/exec.cpp index dc69f7ad3..f8689840f 100644 --- a/exec.cpp +++ b/exec.cpp @@ -359,7 +359,7 @@ static void safe_launch_process( process_t *p, const char *actual_cmd, char **ar } /** - This function is similar to launch_process, except it is not called after a fork (i.e. it is only calls exec) and therefore it can allocate memory. + This function is similar to launch_process, except it is not called after a fork (i.e. it only calls exec) and therefore it can allocate memory. */ static void launch_process_nofork( process_t *p ) { diff --git a/fish_indent.cpp b/fish_indent.cpp index c99c7a9e3..0ccaef448 100644 --- a/fish_indent.cpp +++ b/fish_indent.cpp @@ -107,23 +107,24 @@ static int indent( wcstring &out, const wcstring &in, int flags ) { int next_indent = indent; is_command = 0; - - wchar_t *unesc = unescape( last, UNESCAPE_SPECIAL ); + + wcstring unesc = last; + unescape_string(unesc, UNESCAPE_SPECIAL); - if( parser_keywords_is_block( unesc ) ) + if( parser_keywords_is_block(unesc)) { next_indent++; } - else if( wcscmp( unesc, L"else" ) == 0 ) + else if (unesc == L"else") { indent--; } /* case should have the same indent level as switch*/ - else if( wcscmp( unesc, L"case" ) == 0 ) + else if (unesc == L"case") { indent--; } - else if( wcscmp( unesc, L"end" ) == 0 ) + else if (unesc == L"end") { indent--; next_indent--;