aboutsummaryrefslogtreecommitdiffhomepage
path: root/builtin.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-02-11 10:13:17 +1000
committerGravatar axel <axel@liljencrantz.se>2006-02-11 10:13:17 +1000
commit20c83ba605183e1a597bf790be1d1d0f06d2651f (patch)
tree09e989c55d6bdf40dbe5d8cbcb4694cbbcf2a3c7 /builtin.c
parente9e32f980bb906994ed8bc1aa26f97fb3df19eec (diff)
Optimize the halloc implementation so that mutiple calls to halloc can be satisfied by a single malloc, also add wcsdup and wcsndup workalikes using halloc
darcs-hash:20060211001317-ac50b-c9cf234c334b4d697fe1251c21013c8ec7f7b0a1.gz
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/builtin.c b/builtin.c
index cb3d9fac..5089765a 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1037,7 +1037,7 @@ static int builtin_function( wchar_t **argv )
if( !e )
die_mem();
e->type = EVENT_VARIABLE;
- e->param1.variable = halloc_register( current_block, wcsdup( woptarg ));
+ e->param1.variable = halloc_wcsdup( current_block, woptarg );
e->function_name=0;
al_push( events, e );
break;
@@ -1201,8 +1201,8 @@ static int builtin_function( wchar_t **argv )
}
else
{
- current_block->param1.function_name=halloc_register( current_block, wcsdup(argv[woptind]));
- current_block->param2.function_description=desc?halloc_register( current_block, wcsdup(desc)):0;
+ current_block->param1.function_name=halloc_wcsdup( current_block, argv[woptind]);
+ current_block->param2.function_description=desc?halloc_wcsdup( current_block, desc):0;
current_block->param3.function_is_binding = is_binding;
current_block->param4.function_events = events;
@@ -2579,11 +2579,11 @@ static int builtin_for( wchar_t **argv )
int i;
current_block->tok_pos = parser_get_pos();
- current_block->param1.for_variable = halloc_register( current_block, wcsdup( argv[1] ));
+ current_block->param1.for_variable = halloc_wcsdup( current_block, argv[1] );
for( i=argc-1; i>3; i-- )
{
- al_push( &current_block->param2.for_vars, halloc_register( current_block, wcsdup(argv[ i ] ) ) );
+ al_push( &current_block->param2.for_vars, halloc_wcsdup( current_block, argv[ i ] ) );
}
halloc_register( current_block, current_block->param2.for_vars.arr );
@@ -2899,7 +2899,7 @@ static int builtin_switch( wchar_t **argv )
else
{
parser_push_block( SWITCH );
- current_block->param1.switch_value = halloc_register( current_block, wcsdup( argv[1]));
+ current_block->param1.switch_value = halloc_wcsdup( current_block, argv[1]);
current_block->skip=1;
current_block->param2.switch_taken=0;
}