2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

Boost Jam code cleanup - execnt.c module no longer double-frees its running commands table slot's action & target variables when reusing the same slot for multiple commands.

[SVN r79043]
This commit is contained in:
Jurko Gospodnetić
2012-06-24 00:18:43 +00:00
parent bf9a2a9671
commit 2d1af99dc3

View File

@@ -425,18 +425,25 @@ void exec_cmd
/* Save the operation for exec_wait() to find. */
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_free( cmdtab[ slot ].action );
string_copy( cmdtab[ slot ].action, action );
string_free( cmdtab[ slot ].target );
string_copy( cmdtab[ slot ].target, target );
}
else
{
string_free( cmdtab[ slot ].action );
string_new ( cmdtab[ slot ].action );
string_free( cmdtab[ slot ].target );
string_new ( cmdtab[ slot ].target );
}
string_copy( cmdtab[ slot ].command, pCommand_orig->value );