From 79e0405f6a6e56c2430d5d74b6c150d0b5d0e2fe Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Mon, 30 Jan 2012 02:23:58 -0800 Subject: Yet more un-hallocing --- expand.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'expand.cpp') diff --git a/expand.cpp b/expand.cpp index cd678d8a..b0fbcf97 100644 --- a/expand.cpp +++ b/expand.cpp @@ -2585,7 +2585,7 @@ int expand_string( void *context, } */ -wchar_t *expand_one( void *context, wchar_t *string, int flags ) +wchar_t *expand_one( void *context, const wchar_t *string, int flags ) { std::vector l; int res; @@ -2595,8 +2595,8 @@ wchar_t *expand_one( void *context, wchar_t *string, int flags ) if( (!(flags & ACCEPT_INCOMPLETE)) && expand_is_clean( string ) ) { - halloc_register( context, string ); - return string; + halloc_register( context, (void *)string ); + return (wchar_t *)string; } // al_init( &l ); @@ -2625,5 +2625,17 @@ wchar_t *expand_one( void *context, wchar_t *string, int flags ) halloc_register( context, one ); return one; } + +bool expand_one( wcstring &in, int flag ) { + bool result = false; + wchar_t *res = expand_one(NULL, in.c_str(), flag); + if (res) { + in = res; + free(res); + result = true; + } + return result; +} + -- cgit v1.2.3