diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2012-05-17 19:37:46 -0700 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2012-05-17 19:38:08 -0700 |
commit | 86645b32e172301088517bfb860b2e0990b3e5ec (patch) | |
tree | 3a085358e6a382074c7569b997a006f2765b7c73 /complete.cpp | |
parent | 977c585f8be898e327221911b505da577619520a (diff) |
Work towards getting function.h off of shared_ptr
Diffstat (limited to 'complete.cpp')
-rw-r--r-- | complete.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/complete.cpp b/complete.cpp index 2a051b39..35e0a5eb 100644 --- a/complete.cpp +++ b/complete.cpp @@ -832,7 +832,7 @@ int complete_is_valid_argument( const wchar_t *str, static void complete_strings( std::vector<completion_t> &comp_out, const wcstring &wc_escaped, const wchar_t *desc, - const wchar_t *(*desc_func)(const wcstring &), + wcstring (*desc_func)(const wcstring &), std::vector<completion_t> &possible_comp, complete_flags_t flags ) { @@ -981,16 +981,20 @@ void completer_t::complete_cmd_desc( const wcstring &str ) } /** - Returns a description for the specified function + Returns a description for the specified function, or an empty string if none */ -static const wchar_t *complete_function_desc( const wcstring &fn ) +static wcstring complete_function_desc( const wcstring &fn ) { + wcstring result; + const wchar_t *res = function_get_desc( fn ); + if (res) { + result = res; + } else { + function_get_definition(fn, &result); + } - if( !res ) - res = function_get_definition( fn ); - - return res; + return result; } |