From d1edcc2be983f59bdf10c5e3fc5942ba87868cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurko=20Gospodneti=C4=87?= Date: Tue, 26 Jun 2012 13:49:06 +0000 Subject: [PATCH] Boost Jam code cleanup - minor stylistic const correctness & comment changes. [SVN r79110] --- v2/engine/execcmd.h | 16 ++++++++-------- v2/engine/execnt.c | 20 ++++++++++---------- v2/engine/execunix.c | 10 +++++----- v2/engine/make1.c | 26 ++++++++++++++------------ 4 files changed, 37 insertions(+), 35 deletions(-) diff --git a/v2/engine/execcmd.h b/v2/engine/execcmd.h index 7b20b3266..6cda0a3a8 100644 --- a/v2/engine/execcmd.h +++ b/v2/engine/execcmd.h @@ -30,11 +30,11 @@ typedef struct timing_info typedef void (* ExecCmdCallback) ( - void * closure, - int status, - timing_info const *, - char const * invoked_command, - char const * command_output + void * const closure, + int const status, + timing_info const * const, + char const * const invoked_command, + char const * const command_output ); /* Status codes passed to ExecCmdCallback routines. */ @@ -44,7 +44,7 @@ typedef void (* ExecCmdCallback) int exec_check ( - string * command, + string const * command, LIST * * pShell, int * error_length, int * error_max_length @@ -62,8 +62,8 @@ void exec_cmd ExecCmdCallback func, void * closure, LIST * shell, - char const * action, - char const * target + char const * const action, + char const * const target ); void exec_wait(); diff --git a/v2/engine/execnt.c b/v2/engine/execnt.c index 54881d44d..f8553c0a6 100644 --- a/v2/engine/execnt.c +++ b/v2/engine/execnt.c @@ -210,7 +210,7 @@ void execnt_unit_test() int exec_check ( - string * command, + string const * command, LIST * * pShell, int * error_length, int * error_max_length @@ -278,8 +278,8 @@ void exec_cmd ExecCmdCallback func, void * closure, LIST * shell, - char const * action, - char const * target + char const * const action, + char const * const target ) { int const slot = get_free_cmdtab_slot(); @@ -421,7 +421,7 @@ void exec_wait() /* The dispossition of the command. */ if ( interrupted() ) rstat = EXEC_CMD_INTR; - else if ( cmdtab[ i ].exit_code != 0 ) + else if ( cmdtab[ i ].exit_code ) rstat = EXEC_CMD_FAIL; else rstat = EXEC_CMD_OK; @@ -441,14 +441,14 @@ void exec_wait() (*cmdtab[ i ].func)( cmdtab[ i ].closure, rstat, &time, cmdtab[ i ].command->value, cmdtab[ i ].buffer_out->value ); - /* Clean up the command data, process, etc. No need to clear the + /* 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 ); + string_renew( cmdtab[ i ].action ); + string_renew( cmdtab[ i ].target ); string_renew( cmdtab[ i ].command ); - closeWinHandle( &cmdtab[ i ].pi.hProcess ); - closeWinHandle( &cmdtab[ i ].pi.hThread ); + closeWinHandle( &cmdtab[ i ].pi.hProcess ); + closeWinHandle( &cmdtab[ i ].pi.hThread ); closeWinHandle( &cmdtab[ i ].pipe_out[ 0 ] ); closeWinHandle( &cmdtab[ i ].pipe_out[ 1 ] ); closeWinHandle( &cmdtab[ i ].pipe_err[ 0 ] ); @@ -912,7 +912,7 @@ static int try_kill_one() if ( t > (double)globs.timeout ) { /* The job may have left an alert dialog around, try and get rid - * of it before killing + * of it before killing. */ close_alert( cmdtab[ i ].pi.hProcess ); /* We have a "runaway" job, kill it. */ diff --git a/v2/engine/execunix.c b/v2/engine/execunix.c index 60a6638a8..c10535515 100644 --- a/v2/engine/execunix.c +++ b/v2/engine/execunix.c @@ -104,7 +104,7 @@ static struct int exec_check ( - string * command, + string const * command, LIST * * pShell, int * error_length, int * error_max_length @@ -141,8 +141,8 @@ void exec_cmd ExecCmdCallback func, void * closure, LIST * shell, - char const * action, - char const * target + char const * const action, + char const * const target ) { int const slot = get_free_cmdtab_slot(); @@ -546,11 +546,11 @@ void exec_wait() rstat = EXEC_CMD_OK; /* Call the callback, may call back to jam rule land. Assume -p0 - * is in effect so only pass buffer[ 0 ] containing merged + * is in effect so only pass buffer[ OUT ] containing merged * output. */ (*cmdtab[ i ].func)( cmdtab[ i ].closure, rstat, &time_info, - cmdtab[ i ].command, cmdtab[ i ].buffer[ 0 ] ); + cmdtab[ i ].command, cmdtab[ i ].buffer[ OUT ] ); BJAM_FREE( cmdtab[ i ].buffer[ OUT ] ); cmdtab[ i ].buffer[ OUT ] = 0; diff --git a/v2/engine/make1.c b/v2/engine/make1.c index a4ee2b9c3..4cebb19c0 100644 --- a/v2/engine/make1.c +++ b/v2/engine/make1.c @@ -99,8 +99,9 @@ static void make1atail ( state * ); static void make1b ( state * ); static void make1c ( state * ); static void make1d ( state * ); -static void make_closure( void * closure, int status, timing_info const *, - char const *, char const * ); +static void make_closure( void * const closure, int const status, + timing_info const * const, char const * const invoked_command, + char const * const command_output ); typedef struct _stack { @@ -838,29 +839,30 @@ static void call_action_rule /* * make_closure() - internal function passed as a notification callback for when - * commands finish getting executed by the OS. + * commands finish getting executed by the OS or called directly when faking + * that the commands had been executed by the OS. */ static void make_closure ( - void * closure, - int status, - timing_info const * time, - char const * executed_command, - char const * command_output + void * const closure, + int const status, + timing_info const * const time, + char const * const invoked_command, + char const * const command_output ) { - TARGET * built = (TARGET *)closure; + TARGET * const t = (TARGET *)closure; --cmdsrunning; - call_timing_rule( built, time ); + call_timing_rule( t, time ); if ( DEBUG_EXECCMD ) printf( "%f sec system; %f sec user\n", time->system, time->user ); - call_action_rule( built, status, time, executed_command, command_output ); + call_action_rule( t, status, time, invoked_command, command_output ); - push_state( &state_stack, built, NULL, T_STATE_MAKE1D )->status = status; + push_state( &state_stack, t, NULL, T_STATE_MAKE1D )->status = status; }