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

Function function_free

src/engine/function.c:3663–3722  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3661}
3662
3663void function_free( FUNCTION * function_ )
3664{
3665 int i;
3666
3667 if ( --function_->reference_count != 0 )
3668 return;
3669
3670 if ( function_->formal_arguments )
3671 argument_list_free( function_->formal_arguments,
3672 function_->num_formal_arguments );
3673
3674 if ( function_->type == FUNCTION_JAM )
3675 {
3676 JAM_FUNCTION * func = (JAM_FUNCTION *)function_;
3677
3678 BJAM_FREE( func->code );
3679
3680 if ( func->generic )
3681 function_free( func->generic );
3682 else
3683 {
3684 if ( function_->rulename ) object_free( function_->rulename );
3685
3686 for ( i = 0; i < func->num_constants; ++i )
3687 object_free( func->constants[ i ] );
3688 BJAM_FREE( func->constants );
3689
3690 for ( i = 0; i < func->num_subfunctions; ++i )
3691 {
3692 object_free( func->functions[ i ].name );
3693 function_free( func->functions[ i ].code );
3694 }
3695 BJAM_FREE( func->functions );
3696
3697 for ( i = 0; i < func->num_subactions; ++i )
3698 {
3699 object_free( func->actions[ i ].name );
3700 function_free( func->actions[ i ].command );
3701 }
3702 BJAM_FREE( func->actions );
3703
3704 object_free( func->file );
3705 }
3706 }
3707#ifdef HAVE_PYTHON
3708 else if ( function_->type == FUNCTION_PYTHON )
3709 {
3710 PYTHON_FUNCTION * func = (PYTHON_FUNCTION *)function_;
3711 Py_DECREF( func->python_function );
3712 if ( function_->rulename ) object_free( function_->rulename );
3713 }
3714#endif
3715 else
3716 {
3717 assert( function_->type == FUNCTION_BUILTIN );
3718 if ( function_->rulename ) object_free( function_->rulename );
3719 }
3720

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