Created
January 21, 2014 13:54
-
-
Save chobie/8540488 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void git_ex_cb(INTERNAL_FUNCTION_PARAMETERS) | |
{ | |
zval *payload, *this = getThis(); | |
char *oid; | |
int oid_len; | |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, | |
"sz", &oid, &oid_len, &payload) == FAILURE) { | |
return; | |
} | |
php_var_dump(&payload, 1 TSRMLS_CC); | |
php_var_dump(&this, 1 TSRMLS_CC); | |
RETURN_STRING("Hello World", 1); | |
} | |
static const zend_arg_info arginfo_git_odb_backend_foreach_callback[] = { | |
ZEND_ARG_INFO(0, oid) | |
ZEND_ARG_INFO(1, payload) | |
}; | |
PHP_FUNCTION(git_ex) | |
{ | |
zend_function function = {0}; | |
zend_arg_info args[2] = {0}, **_args = NULL; | |
zval *hoge; | |
MAKE_STD_ZVAL(hoge); | |
object_init_ex(hoge, php_git2_odb_backend_foreach_callback_class_entry); | |
Z_ADDREF_P(hoge); | |
// Git2\ODB\Backend\ForeachCallback | |
function.type = ZEND_INTERNAL_FUNCTION; | |
function.common.function_name = "callback"; | |
function.common.fn_flags = ZEND_ACC_CLOSURE; | |
function.common.num_args = 2; | |
function.common.required_num_args = 2; | |
function.common.arg_info = &arginfo_git_odb_backend_foreach_callback; | |
function.common.scope = php_git2_odb_backend_foreach_callback_class_entry; | |
function.internal_function.type = ZEND_INTERNAL_FUNCTION; | |
function.internal_function.scope = php_git2_odb_backend_foreach_callback_class_entry; | |
function.internal_function.fn_flags = ZEND_ACC_CLOSURE; | |
function.internal_function.handler = git_ex_cb; | |
function.internal_function.module = &git2_module_entry; | |
function.internal_function.num_args = 2; | |
function.internal_function.required_num_args = 2; | |
function.internal_function.arg_info = &arginfo_git_odb_backend_foreach_callback; | |
zend_create_closure(return_value, &function, php_git2_odb_backend_foreach_callback_class_entry, hoge TSRMLS_CC); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment