From 9b56b67c0e1bbd7f043ca6d17715427ab6d40e9f Mon Sep 17 00:00:00 2001 From: Siteshwar Vashisht Date: Thu, 12 Jan 2012 04:21:11 +0530 Subject: [PATCH] Revert "Modified expand.cpp and exec.cpp to use env_get_string()" This reverts commit 48655e882ef02efe50e1b5a05e1b0ae653861c3d. --- exec.cpp | 2 +- expand.cpp | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/exec.cpp b/exec.cpp index e49644e15..384fa4e36 100644 --- a/exec.cpp +++ b/exec.cpp @@ -1740,7 +1740,7 @@ int exec_subshell( const wchar_t *cmd, CHECK( cmd, -1 ); - ifs = env_get_string(L"IFS").empty()?NULL:env_get_string(L"IFS").c_str(); + ifs = env_get_string(L"IFS").empty()?NULL:env_get_string(L"IFS"); if( ifs && ifs[0] ) { diff --git a/expand.cpp b/expand.cpp index 3dc94068a..11bc43172 100644 --- a/expand.cpp +++ b/expand.cpp @@ -176,11 +176,11 @@ int expand_is_clean( const wchar_t *in ) /** Return the environment variable value for the string starting at \c in. */ -static wcstring expand_var( wchar_t *in ) +static wchar_t *expand_var( wchar_t *in ) { if( !in ) return 0; - return env_get_string( in ); + return env_get( in ); } /** @@ -958,8 +958,7 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx ) int start_pos = i+1; int stop_pos; int var_len, new_len; - const wchar_t * var_val; - wcstring var_val_wstr; + wchar_t * var_val; wchar_t * new_in; int is_single = (c==VARIABLE_EXPAND_SINGLE); int var_name_stop_pos; @@ -992,8 +991,7 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx ) sb_append_substring( var_tmp, &in[start_pos], var_len ); - var_val_wstr = expand_var( (wchar_t *)var_tmp->buff ); - var_val = var_val_wstr.empty()?NULL:var_val_wstr.c_str(); + var_val = expand_var( (wchar_t *)var_tmp->buff ); if( var_val ) {