From 0105ec284d7939815c6643781c1de5e67317b459 Mon Sep 17 00:00:00 2001 From: axel Date: Thu, 16 Nov 2006 23:08:33 +1000 Subject: Don't intern as much completion data - this helps reduce memory usage when autounloading darcs-hash:20061116130833-ac50b-b19887dc36b16476bb3b2a1593b23dd3325187ee.gz --- complete.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'complete.c') diff --git a/complete.c b/complete.c index ba7de179..028cf86d 100644 --- a/complete.c +++ b/complete.c @@ -353,7 +353,7 @@ static void complete_free_opt_recursive( complete_entry_opt_t *o ) { if( o->next != 0 ) complete_free_opt_recursive( o->next ); - free(o); + halloc_free( o ); } /** @@ -430,10 +430,7 @@ void complete_add( const wchar_t *cmd, c->short_opt_str = wcsdup(L""); } - if( !(opt = malloc( sizeof( complete_entry_opt_t ) ))) - { - DIE_MEM(); - } + opt = halloc( 0, sizeof( complete_entry_opt_t ) ); opt->next = c->first_option; c->first_option = opt; @@ -456,13 +453,13 @@ void complete_add( const wchar_t *cmd, opt->result_mode = result_mode; opt->old_mode=old_mode; - opt->comp = intern(comp?comp:L""); - opt->condition = intern(condition?condition:L""); - opt->long_opt = intern( long_opt?long_opt:L"" ); + opt->comp = comp?halloc_wcsdup(opt, comp):L""; + opt->condition = condition?halloc_wcsdup(opt, condition):L""; + opt->long_opt = long_opt?halloc_wcsdup(opt, long_opt):L"" ; if( desc && wcslen( desc ) ) { - opt->desc = intern( desc ); + opt->desc = halloc_wcsdup( opt, desc ); } else { -- cgit v1.2.3