MCPcopy Create free account
hub / github.com/boostorg/build / function_free

Function function_free

v2/engine/function.c:3564–3623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3562}
3563
3564void function_free( FUNCTION * function_ )
3565{
3566 int i;
3567
3568 if ( --function_->reference_count != 0 )
3569 return;
3570
3571 if ( function_->formal_arguments )
3572 argument_list_free( function_->formal_arguments,
3573 function_->num_formal_arguments );
3574
3575 if ( function_->type == FUNCTION_JAM )
3576 {
3577 JAM_FUNCTION * func = (JAM_FUNCTION *)function_;
3578
3579 BJAM_FREE( func->code );
3580
3581 if ( func->generic )
3582 function_free( func->generic );
3583 else
3584 {
3585 if ( function_->rulename ) object_free( function_->rulename );
3586
3587 for ( i = 0; i < func->num_constants; ++i )
3588 object_free( func->constants[ i ] );
3589 BJAM_FREE( func->constants );
3590
3591 for ( i = 0; i < func->num_subfunctions; ++i )
3592 {
3593 object_free( func->functions[ i ].name );
3594 function_free( func->functions[ i ].code );
3595 }
3596 BJAM_FREE( func->functions );
3597
3598 for ( i = 0; i < func->num_subactions; ++i )
3599 {
3600 object_free( func->actions[ i ].name );
3601 function_free( func->actions[ i ].command );
3602 }
3603 BJAM_FREE( func->actions );
3604
3605 object_free( func->file );
3606 }
3607 }
3608#ifdef HAVE_PYTHON
3609 else if ( function_->type == FUNCTION_PYTHON )
3610 {
3611 PYTHON_FUNCTION * func = (PYTHON_FUNCTION *)function_;
3612 Py_DECREF( func->python_function );
3613 if ( function_->rulename ) object_free( function_->rulename );
3614 }
3615#endif
3616 else
3617 {
3618 assert( function_->type == FUNCTION_BUILTIN );
3619 if ( function_->rulename ) object_free( function_->rulename );
3620 }
3621

Callers 9

delete_native_ruleFunction · 0.85
rule_freeFunction · 0.85
actions_freeFunction · 0.85
set_rule_bodyFunction · 0.85
rule_localizeFunction · 0.85
bind_builtinFunction · 0.85
bjam_define_actionFunction · 0.85
evaluate_ruleFunction · 0.85
parse_fileFunction · 0.85

Calls 2

argument_list_freeFunction · 0.85
object_freeFunction · 0.85

Tested by

no test coverage detected