mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-11 05:31:14 -03:00
Replace the count function with a builtin for performance reasons. The count function used at least two forks, which was noticable on systems such as OS X with slow forks
darcs-hash:20070731212332-ac50b-8f5b2e70008ddb131dc8bae3f361d8d65a294948.gz
This commit is contained in:
17
parser.c
17
parser.c
@@ -1401,18 +1401,17 @@ static void parse_job_argument_list( process_t *p,
|
||||
|
||||
if( !skip )
|
||||
{
|
||||
if( proc_is_count &&
|
||||
(al_get_count( args) == 1) &&
|
||||
( parser_is_help( tok_last(tok), 0) ) )
|
||||
if( ( proc_is_count ) &&
|
||||
( al_get_count( args) == 1) &&
|
||||
( parser_is_help( tok_last(tok), 0) ) &&
|
||||
( p->type == INTERNAL_BUILTIN ) )
|
||||
{
|
||||
/*
|
||||
Display help for count
|
||||
*/
|
||||
p->type = INTERNAL_BUILTIN;
|
||||
p->actual_cmd = L"count";
|
||||
p->count_help_magic = 1;
|
||||
}
|
||||
|
||||
|
||||
switch( expand_string( j, wcsdup(tok_last( tok )), args, 0 ) )
|
||||
{
|
||||
case EXPAND_ERROR:
|
||||
@@ -1421,9 +1420,9 @@ static void parse_job_argument_list( process_t *p,
|
||||
if( error_code == 0 )
|
||||
{
|
||||
error( SYNTAX_ERROR,
|
||||
tok_get_pos( tok ),
|
||||
_(L"Could not expand string '%ls'"),
|
||||
tok_last(tok) );
|
||||
tok_get_pos( tok ),
|
||||
_(L"Could not expand string '%ls'"),
|
||||
tok_last(tok) );
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user