-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphp-function.cpp
42 lines (34 loc) · 912 Bytes
/
php-function.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* php-function.cpp
*
* Copyright (C) Roger P. Gee
*/
#include "php-function.h"
using namespace php_git2;
void php_git2::php_extract_args_impl(int nargs,php_parameter* dest[],int ngiven)
{
zval args;
int result;
HashPosition pos;
array_init_size(&args,nargs);
result = zend_copy_parameters_array(nargs,&args);
if (result == FAILURE) {
zval_ptr_dtor(&args);
throw php_git2_exception("%s() expects exactly %d parameters, %d given",
get_active_function_name(),
nargs,
ngiven);
}
zend_hash_internal_pointer_reset_ex(Z_ARRVAL(args),&pos);
for (int i = 0;i < nargs;++i) {
dest[i]->parse(zend_hash_get_current_data_ex(Z_ARRVAL(args),&pos),i+1);
zend_hash_move_forward_ex(Z_ARRVAL(args),&pos);
}
zval_ptr_dtor(&args);
}
/*
* Local Variables:
* indent-tabs-mode:nil
* tab-width:4
* End:
*/