diff --git a/src/engine/execcmd.h b/src/engine/execcmd.h index e4ec55744..2224a42ca 100644 --- a/src/engine/execcmd.h +++ b/src/engine/execcmd.h @@ -35,9 +35,7 @@ typedef void (* ExecCmdCallback) timing_info const * const, char const * const cmd_stdout, char const * const cmd_stderr, - int const cmd_exit_reason, - char const * const rule_name, - char const * const target_name + int const cmd_exit_reason ); /* Status codes passed to ExecCmdCallback routines. */ @@ -64,9 +62,7 @@ void exec_cmd string const * command, ExecCmdCallback func, void * closure, - LIST * shell, - char const * const action, - char const * const target + LIST * shell ); void exec_wait(); diff --git a/src/engine/execnt.c b/src/engine/execnt.c index 5949e5eb0..f85cacc43 100644 --- a/src/engine/execnt.c +++ b/src/engine/execnt.c @@ -118,9 +118,6 @@ static int intr_installed; /* The list of commands we run. */ static struct { - string action[ 1 ]; /* buffer to hold action */ - string target[ 1 ]; /* buffer to hold target */ - /* Temporary command file used to execute the action when needed. */ string command_file[ 1 ]; @@ -272,9 +269,7 @@ void exec_cmd string const * cmd_orig, ExecCmdCallback func, void * closure, - LIST * shell, - char const * const action, - char const * const target + LIST * shell ) { int const slot = get_free_cmdtab_slot(); @@ -338,31 +333,8 @@ void exec_cmd } /* Save input data into the selected running commands table slot. */ - { - cmdtab[ slot ].func = func; - cmdtab[ slot ].closure = closure; - /* No need to free action and target cmdtab[ slot ] members here as they - * have either never been explicitly constructed before (and are thus - * zero initialized) or have been freed when the previous command in the - * same slot has been cleaned up. - */ - assert( !cmdtab[ slot ].action->size ); - assert( !cmdtab[ slot ].action->value || cmdtab[ slot ].action->value == - cmdtab[ slot ].action->opt ); - assert( !cmdtab[ slot ].target->size ); - assert( !cmdtab[ slot ].target->value || cmdtab[ slot ].target->value == - cmdtab[ slot ].target->opt ); - if ( action && target ) - { - string_copy( cmdtab[ slot ].action, action ); - string_copy( cmdtab[ slot ].target, target ); - } - else - { - string_new( cmdtab[ slot ].action ); - string_new( cmdtab[ slot ].target ); - } - } + cmdtab[ slot ].func = func; + cmdtab[ slot ].closure = closure; /* Invoke the actual external process using the constructed command line. */ invoke_cmd( cmd_local->value, slot ); @@ -427,14 +399,11 @@ void exec_wait() /* Call the callback, may call back to jam rule land. */ (*cmdtab[ i ].func)( cmdtab[ i ].closure, rstat, &time, cmdtab[ i ].buffer_out->value, cmdtab[ i ].buffer_err->value, - exit_reason, cmdtab[ i ].action->size ? cmdtab[ i ].action->value : - 0, cmdtab[ i ].target->size ? cmdtab[ i ].target->value : 0 ); + exit_reason ); /* Clean up our child process tracking data. No need to clear the * temporary command file name as it gets reused. */ - string_renew( cmdtab[ i ].action ); - string_renew( cmdtab[ i ].target ); closeWinHandle( &cmdtab[ i ].pi.hProcess ); closeWinHandle( &cmdtab[ i ].pi.hThread ); closeWinHandle( &cmdtab[ i ].pipe_out[ 0 ] ); diff --git a/src/engine/execunix.c b/src/engine/execunix.c index 8d84ec433..3ea422a1f 100644 --- a/src/engine/execunix.c +++ b/src/engine/execunix.c @@ -81,10 +81,6 @@ static struct FILE * stream[ 2 ]; /* child's stdout (0) and stderr (1) file stream */ clock_t start_time; /* start time of child process */ int exit_reason; /* termination status */ - int action_length; /* length of action string */ - int target_length; /* length of target string */ - char * action; /* buffer to hold the action name (if not quiet) */ - char * target; /* buffer to hold the target name (if not quiet) */ char * buffer[ 2 ]; /* buffers to hold stdout and stderr, if any */ int buf_size[ 2 ]; /* buffer sizes in bytes */ time_t start_dt; /* start of command timestamp */ @@ -139,9 +135,7 @@ void exec_cmd string const * command, ExecCmdCallback func, void * closure, - LIST * shell, - char const * const action, - char const * const target + LIST * shell ) { int const slot = get_free_cmdtab_slot(); @@ -290,36 +284,6 @@ void exec_cmd /* Save input data into the selected running commands table slot. */ cmdtab[ slot ].func = func; cmdtab[ slot ].closure = closure; - - /* Ensure enough room for rule and target name. */ - if ( action && target ) - { - len = strlen( action ) + 1; - if ( cmdtab[ slot ].action_length < len ) - { - BJAM_FREE( cmdtab[ slot ].action ); - cmdtab[ slot ].action = BJAM_MALLOC_ATOMIC( len ); - cmdtab[ slot ].action_length = len; - } - strcpy( cmdtab[ slot ].action, action ); - len = strlen( target ) + 1; - if ( cmdtab[ slot ].target_length < len ) - { - BJAM_FREE( cmdtab[ slot ].target ); - cmdtab[ slot ].target = BJAM_MALLOC_ATOMIC( len ); - cmdtab[ slot ].target_length = len; - } - strcpy( cmdtab[ slot ].target, target ); - } - else - { - BJAM_FREE( cmdtab[ slot ].action ); - BJAM_FREE( cmdtab[ slot ].target ); - cmdtab[ slot ].action = 0; - cmdtab[ slot ].target = 0; - cmdtab[ slot ].action_length = 0; - cmdtab[ slot ].target_length = 0; - } } #undef EXECCMD_PIPE_READ @@ -538,8 +502,7 @@ void exec_wait() /* Call the callback, may call back to jam rule land. */ (*cmdtab[ i ].func)( cmdtab[ i ].closure, rstat, &time_info, cmdtab[ i ].buffer[ OUT ], cmdtab[ i ].buffer[ ERR ], - cmdtab[ i ].exit_reason, cmdtab[ i ].action, - cmdtab[ i ].target ); + cmdtab[ i ].exit_reason ); BJAM_FREE( cmdtab[ i ].buffer[ OUT ] ); cmdtab[ i ].buffer[ OUT ] = 0; diff --git a/src/engine/make1.c b/src/engine/make1.c index 7613dc37e..17a8f2aa2 100644 --- a/src/engine/make1.c +++ b/src/engine/make1.c @@ -101,8 +101,7 @@ static void make1c ( state * ); static void make1d ( state * ); static void make_closure( void * const closure, int const status, timing_info const * const, char const * const cmd_stdout, - char const * const cmd_stderr, int const cmd_exit_reason, - char const * const rule_name, char const * const target_name ); + char const * const cmd_stderr, int const cmd_exit_reason ); typedef struct _stack { @@ -529,9 +528,6 @@ static void make1c( state * pState ) if ( cmd && ( pState->t->status == EXEC_CMD_OK ) ) { - char const * rule_name = 0; - char const * target_name = 0; - /* Pop state first in case exec_cmd(), exec_wait() or make_closure() * push a new state. Collect the target off the stack before that to * avoid accessing data later from a freed stack node. @@ -539,13 +535,6 @@ static void make1c( state * pState ) TARGET * t = pState->t ; pop_state( &state_stack ); - if ( DEBUG_MAKEQ || - ( !( cmd->rule->actions->flags & RULE_QUIETLY ) && DEBUG_MAKE ) ) - { - rule_name = object_str( cmd->rule->name ); - target_name = object_str( list_front( lol_get( &cmd->args, 0 ) ) ); - } - /* Increment the jobs running counter. */ ++cmdsrunning; @@ -554,13 +543,11 @@ static void make1c( state * pState ) { timing_info time_info = { 0 } ; time_info.start = time_info.end = time( 0 ); - make_closure( t, EXEC_CMD_OK, &time_info, "", "", EXIT_OK, - rule_name, target_name ); + make_closure( t, EXEC_CMD_OK, &time_info, "", "", EXIT_OK ); } else { - exec_cmd( cmd->buf, make_closure, t, cmd->shell, rule_name, - target_name ); + exec_cmd( cmd->buf, make_closure, t, cmd->shell ); /* Wait until under the concurrent command count limit. */ assert( 0 < globs.jobs ); @@ -839,14 +826,22 @@ static void make_closure timing_info const * const time, char const * const cmd_stdout, char const * const cmd_stderr, - int const cmd_exit_reason, - char const * const rule_name, - char const * const target_name + int const cmd_exit_reason ) { TARGET * const t = (TARGET *)closure; CMD const * const cmd = (CMD *)t->cmds; + char const * rule_name = 0; + char const * target_name = 0; + assert( cmd ); + if ( DEBUG_MAKEQ || + ( DEBUG_MAKE && !( cmd->rule->actions->flags & RULE_QUIETLY ) ) ) + { + rule_name = object_str( cmd->rule->name ); + target_name = object_str( list_front( lol_get( (LOL *)&cmd->args, 0 ) ) + ); + } --cmdsrunning;