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

Function function_free

src/engine/function.cpp:3905–3961  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3903}
3904
3905void function_free( FUNCTION * function_ )
3906{
3907 int32_t i;
3908
3909 if ( --function_->reference_count != 0 )
3910 return;
3911
3912 if ( function_->formal_arguments )
3913 argument_list_free( function_->formal_arguments,
3914 function_->num_formal_arguments );
3915
3916 if ( function_->type == FUNCTION_JAM )
3917 {
3918 JAM_FUNCTION * func = (JAM_FUNCTION *)function_;
3919
3920 BJAM_FREE( func->code );
3921
3922 if ( func->generic )
3923 function_free( func->generic );
3924 else
3925 {
3926 if ( function_->rulename ) object_free( function_->rulename );
3927
3928 for ( i = 0; i < func->num_constants; ++i )
3929 object_free( func->constants[ i ] );
3930 BJAM_FREE( func->constants );
3931
3932 for ( i = 0; i < func->num_subfunctions; ++i )
3933 {
3934 object_free( func->functions[ i ].name );
3935 function_free( func->functions[ i ].code );
3936 }
3937 BJAM_FREE( func->functions );
3938
3939 for ( i = 0; i < func->num_subactions; ++i )
3940 {
3941 object_free( func->actions[ i ].name );
3942 function_free( func->actions[ i ].command );
3943 }
3944 BJAM_FREE( func->actions );
3945
3946 object_free( func->file );
3947 }
3948 }
3949#ifdef HAVE_PYTHON
3950 else if ( function_->type == FUNCTION_PYTHON )
3951 {
3952 PYTHON_FUNCTION * func = (PYTHON_FUNCTION *)function_;
3953 Py_DECREF( func->python_function );
3954 if ( function_->rulename ) object_free( function_->rulename );
3955 }
3956#endif
3957 else
3958 {
3959 assert( function_->type == FUNCTION_BUILTIN );
3960 if ( function_->rulename ) object_free( function_->rulename );
3961 }
3962

Callers 10

parse_implFunction · 0.85
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
bind_builtinFunction · 0.85
evaluate_ruleFunction · 0.85

Calls 2

argument_list_freeFunction · 0.85
object_freeFunction · 0.85

Tested by

no test coverage detected