diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-01-13 23:44:18 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-01-13 23:54:49 -0800 |
commit | 8ba79d6ab9093388df36c06c2b9e2e2b95014cd5 (patch) | |
tree | 6e8f5780d241a702d8046dd328e504e9d4eef917 /exec.cpp | |
parent | 57c9eeeecb57a618ab534135f07144a4bbc99324 (diff) |
Migrate function.cpp to STL types.
Diffstat (limited to 'exec.cpp')
-rw-r--r-- | exec.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -1175,7 +1175,6 @@ void exec( job_t *j ) { const wchar_t * orig_def; wchar_t * def=0; - array_list_t *named_arguments; int shadows; @@ -1187,14 +1186,20 @@ void exec( job_t *j ) signal_unblock(); orig_def = function_get_definition( p->argv[0] ); - named_arguments = function_get_named_arguments( p->argv[0] ); + + // function_get_named_arguments may trigger autoload, which deallocates the orig_def. + // We should make function_get_definition return a wcstring (but how to handle NULL...) + if (orig_def) + orig_def = wcsdup(orig_def); + + wcstring_list_t named_arguments = function_get_named_arguments( p->argv[0] ); shadows = function_get_shadows( p->argv[0] ); signal_block(); if( orig_def ) { - def = (wchar_t *)halloc_register( j, wcsdup(orig_def) ); + def = (wchar_t *)halloc_register( j, const_cast<wchar_t *>(orig_def) ); } if( def == 0 ) { |