@@ -931,7 +931,6 @@ static int php_git2_odb_backend_exists(git_odb_backend *backend, const git_oid *
931931 }
932932 zval_ptr_dtor (& retval_ptr );
933933 return !retval ;
934-
935934}
936935
937936static const zend_arg_info arginfo_git_odb_backend_foreach_callback [] = {
@@ -1013,17 +1012,44 @@ static int php_git2_odb_backend_foreach(git_odb_backend *backend, git_odb_foreac
10131012
10141013static void php_git2_odb_backend_free (git_odb_backend * _backend )
10151014{
1015+ php_git2_t * result ;
1016+ php_git2_odb_backend * php_backend = (php_git2_odb_backend * )_backend ;
1017+ zval * retval_ptr = NULL ;
1018+ php_git2_multi_cb_t * p = php_backend -> multi ;
1019+ int i = 0 , retval = 0 ;
1020+ GIT2_TSRMLS_SET (p -> tsrm_ls );
1021+ if (php_git2_call_function_v (& p -> callbacks [7 ].fci , & p -> callbacks [7 ].fcc TSRMLS_CC , & retval_ptr , 0 )) {
1022+ return ;
1023+ }
1024+
1025+ zval_ptr_dtor (& retval_ptr );
1026+ return ;
10161027}
10171028
1029+ static void php_git2_odb_refresh (git_odb_backend * _backend )
1030+ {
1031+ php_git2_t * result ;
1032+ php_git2_odb_backend * php_backend = (php_git2_odb_backend * )_backend ;
1033+ zval * retval_ptr = NULL ;
1034+ php_git2_multi_cb_t * p = php_backend -> multi ;
1035+ int i = 0 , retval = 0 ;
1036+ GIT2_TSRMLS_SET (p -> tsrm_ls );
1037+ if (php_git2_call_function_v (& p -> callbacks [8 ].fci , & p -> callbacks [8 ].fcc TSRMLS_CC , & retval_ptr , 0 )) {
1038+ return ;
1039+ }
1040+
1041+ zval_ptr_dtor (& retval_ptr );
1042+ return ;
1043+ }
10181044PHP_FUNCTION (git_odb_backend_new )
10191045{
10201046 php_git2_odb_backend * backend ;
10211047 php_git2_t * result ;
10221048 zval * callbacks , * tmp ;
10231049 zend_fcall_info read_fci , write_fci , read_prefix_fci , read_header_fci , writestream_fci ,
1024- exists_fci , foreach_fci , free_fci ;
1050+ exists_fci , foreach_fci , free_fci , refresh_fci ;
10251051 zend_fcall_info_cache read_fcc , write_fcc , read_prefix_fcc , read_header_fcc , writestream_fcc ,
1026- exists_fcc , foreach_fcc , free_fcc ;
1052+ exists_fcc , foreach_fcc , free_fcc , refresh_fcc ;
10271053
10281054 if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
10291055 "a" , & callbacks ) == FAILURE ) {
@@ -1041,6 +1067,7 @@ PHP_FUNCTION(git_odb_backend_new)
10411067 backend -> parent .exists = & php_git2_odb_backend_exists ;
10421068 backend -> parent .foreach = & php_git2_odb_backend_foreach ;
10431069 backend -> parent .free = & php_git2_odb_backend_free ;
1070+ backend -> parent .refresh = & php_git2_odb_refresh ;
10441071
10451072 tmp = php_git2_read_arrval (callbacks , ZEND_STRS ("read" ) TSRMLS_CC );
10461073 if (tmp ) {
@@ -1067,17 +1094,26 @@ PHP_FUNCTION(git_odb_backend_new)
10671094 if (tmp ) {
10681095 php_git2_fcall_info_wrapper2 (tmp , & foreach_fci , & foreach_fcc TSRMLS_CC );
10691096 }
1097+ tmp = php_git2_read_arrval (callbacks , ZEND_STRS ("free" ) TSRMLS_CC );
1098+ if (tmp ) {
1099+ php_git2_fcall_info_wrapper2 (tmp , & free_fci , & free_fcc TSRMLS_CC );
1100+ }
1101+ tmp = php_git2_read_arrval (callbacks , ZEND_STRS ("refresh" ) TSRMLS_CC );
1102+ if (tmp ) {
1103+ php_git2_fcall_info_wrapper2 (tmp , & refresh_fci , & refresh_fcc TSRMLS_CC );
1104+ }
10701105
10711106 Z_ADDREF_P (callbacks );
1072- php_git2_multi_cb_init (& backend -> multi , callbacks TSRMLS_CC , 8 ,
1107+ php_git2_multi_cb_init (& backend -> multi , callbacks TSRMLS_CC , 9 ,
10731108 & read_fci , & read_fcc ,
10741109 & write_fci , & write_fcc ,
10751110 & read_prefix_fci , & read_prefix_fcc ,
10761111 & read_header_fci , & read_header_fcc ,
10771112 & writestream_fci , & writestream_fcc ,
10781113 & exists_fci , & exists_fcc ,
10791114 & foreach_fci , & foreach_fcc ,
1080- & free_fci , & free_fcc
1115+ & free_fci , & free_fcc ,
1116+ & refresh_fci , & refresh_fcc
10811117 );
10821118
10831119 if (php_git2_make_resource (& result , PHP_GIT2_TYPE_ODB_BACKEND , backend , 1 TSRMLS_CC )) {
0 commit comments