6
6
*/
7
7
PHP_FUNCTION (git_remote_create )
8
8
{
9
- php_git2_t * result = NULL ;
9
+ php_git2_t * result = NULL , * _repo = NULL ;
10
10
git_remote * out = NULL ;
11
11
zval * repo = NULL ;
12
- php_git2_t * _repo = NULL ;
13
- char * name = NULL ;
14
- int name_len = 0 ;
15
- char * url = NULL ;
16
- int url_len = 0 ;
17
- int error = 0 ;
12
+ char * name = NULL , * url = NULL ;
13
+ int name_len = 0 , url_len = 0 , error = 0 ;
18
14
19
15
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
20
16
"rss" , & repo , & name , & name_len , & url , & url_len ) == FAILURE ) {
@@ -26,12 +22,10 @@ PHP_FUNCTION(git_remote_create)
26
22
if (php_git2_check_error (error , "git_remote_create" TSRMLS_CC )) {
27
23
RETURN_FALSE ;
28
24
}
29
- PHP_GIT2_MAKE_RESOURCE (result );
30
- PHP_GIT2_V (result , remote ) = out ;
31
- result -> type = PHP_GIT2_TYPE_REMOTE ;
32
- result -> resource_id = PHP_GIT2_LIST_INSERT (result , git2_resource_handle );
33
- result -> should_free_v = 0 ;
34
- ZVAL_RESOURCE (return_value , result -> resource_id );
25
+ if (php_git2_make_resource (& result , PHP_GIT2_TYPE_REMOTE , out , 1 TSRMLS_CC )) {
26
+ RETURN_FALSE ;
27
+ }
28
+ ZVAL_RESOURCE (return_value , GIT2_RVAL_P (result ));
35
29
}
36
30
/* }}} */
37
31
@@ -40,17 +34,11 @@ PHP_FUNCTION(git_remote_create)
40
34
*/
41
35
PHP_FUNCTION (git_remote_create_with_fetchspec )
42
36
{
43
- php_git2_t * result = NULL ;
37
+ php_git2_t * result = NULL , * _repo = NULL ;
44
38
git_remote * out = NULL ;
45
39
zval * repo = NULL ;
46
- php_git2_t * _repo = NULL ;
47
- char * name = NULL ;
48
- int name_len = 0 ;
49
- char * url = NULL ;
50
- int url_len = 0 ;
51
- char * fetch = NULL ;
52
- int fetch_len = 0 ;
53
- int error = 0 ;
40
+ char * name = NULL , * url = NULL , * fetch = NULL ;
41
+ int name_len = 0 , url_len = 0 , fetch_len = 0 , error = 0 ;
54
42
55
43
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
56
44
"rsss" , & repo , & name , & name_len , & url , & url_len , & fetch , & fetch_len ) == FAILURE ) {
@@ -62,29 +50,24 @@ PHP_FUNCTION(git_remote_create_with_fetchspec)
62
50
if (php_git2_check_error (error , "git_remote_create_with_fetchspec" TSRMLS_CC )) {
63
51
RETURN_FALSE ;
64
52
}
65
- PHP_GIT2_MAKE_RESOURCE (result );
66
- PHP_GIT2_V (result , remote ) = out ;
67
- result -> type = PHP_GIT2_TYPE_REMOTE ;
68
- result -> resource_id = PHP_GIT2_LIST_INSERT (result , git2_resource_handle );
69
- result -> should_free_v = 0 ;
70
- ZVAL_RESOURCE (return_value , result -> resource_id );
53
+ if (php_git2_make_resource (& result , PHP_GIT2_TYPE_REMOTE , out , 1 TSRMLS_CC )) {
54
+ RETURN_FALSE ;
55
+ }
56
+ ZVAL_RESOURCE (return_value , GIT2_RVAL_P (result ));
71
57
}
72
58
/* }}} */
73
59
74
60
61
+
75
62
/* {{{ proto resource git_remote_create_inmemory(resource $repo, string $fetch, string $url)
76
63
*/
77
64
PHP_FUNCTION (git_remote_create_inmemory )
78
65
{
79
- php_git2_t * result = NULL ;
66
+ php_git2_t * result = NULL , * _repo = NULL ;
80
67
git_remote * out = NULL ;
81
68
zval * repo = NULL ;
82
- php_git2_t * _repo = NULL ;
83
- char * fetch = NULL ;
84
- int fetch_len = 0 ;
85
- char * url = NULL ;
86
- int url_len = 0 ;
87
- int error = 0 ;
69
+ char * fetch = NULL , * url = NULL ;
70
+ int fetch_len = 0 , url_len = 0 , error = 0 ;
88
71
89
72
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
90
73
"rss" , & repo , & fetch , & fetch_len , & url , & url_len ) == FAILURE ) {
@@ -96,26 +79,22 @@ PHP_FUNCTION(git_remote_create_inmemory)
96
79
if (php_git2_check_error (error , "git_remote_create_inmemory" TSRMLS_CC )) {
97
80
RETURN_FALSE ;
98
81
}
99
- PHP_GIT2_MAKE_RESOURCE (result );
100
- PHP_GIT2_V (result , remote ) = out ;
101
- result -> type = PHP_GIT2_TYPE_REMOTE ;
102
- result -> resource_id = PHP_GIT2_LIST_INSERT (result , git2_resource_handle );
103
- result -> should_free_v = 0 ;
104
- ZVAL_RESOURCE (return_value , result -> resource_id );
82
+ if (php_git2_make_resource (& result , PHP_GIT2_TYPE_REMOTE , out , 1 TSRMLS_CC )) {
83
+ RETURN_FALSE ;
84
+ }
85
+ ZVAL_RESOURCE (return_value , GIT2_RVAL_P (result ));
105
86
}
106
87
/* }}} */
107
88
108
89
/* {{{ proto resource git_remote_load(resource $repo, string $name)
109
90
*/
110
91
PHP_FUNCTION (git_remote_load )
111
92
{
112
- php_git2_t * result = NULL ;
93
+ php_git2_t * result = NULL , * _repo = NULL ;
113
94
git_remote * out = NULL ;
114
95
zval * repo = NULL ;
115
- php_git2_t * _repo = NULL ;
116
96
char * name = NULL ;
117
- int name_len = 0 ;
118
- int error = 0 ;
97
+ int name_len = 0 , error = 0 ;
119
98
120
99
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
121
100
"rs" , & repo , & name , & name_len ) == FAILURE ) {
@@ -127,15 +106,14 @@ PHP_FUNCTION(git_remote_load)
127
106
if (php_git2_check_error (error , "git_remote_load" TSRMLS_CC )) {
128
107
RETURN_FALSE ;
129
108
}
130
- PHP_GIT2_MAKE_RESOURCE (result );
131
- PHP_GIT2_V (result , remote ) = out ;
132
- result -> type = PHP_GIT2_TYPE_REMOTE ;
133
- result -> resource_id = PHP_GIT2_LIST_INSERT (result , git2_resource_handle );
134
- result -> should_free_v = 0 ;
135
- ZVAL_RESOURCE (return_value , result -> resource_id );
109
+ if (php_git2_make_resource (& result , PHP_GIT2_TYPE_REMOTE , out , 1 TSRMLS_CC )) {
110
+ RETURN_FALSE ;
111
+ }
112
+ ZVAL_RESOURCE (return_value , GIT2_RVAL_P (result ));
136
113
}
137
114
/* }}} */
138
115
116
+
139
117
/* {{{ proto long git_remote_save(resource $remote)
140
118
*/
141
119
PHP_FUNCTION (git_remote_save )
@@ -156,15 +134,13 @@ PHP_FUNCTION(git_remote_save)
156
134
}
157
135
/* }}} */
158
136
159
-
160
137
/* {{{ proto resource git_remote_owner(resource $remote)
161
138
*/
162
139
PHP_FUNCTION (git_remote_owner )
163
140
{
164
141
git_repository * result = NULL ;
165
142
zval * remote = NULL ;
166
- php_git2_t * _remote = NULL ;
167
- php_git2_t * __result = NULL ;
143
+ php_git2_t * _remote = NULL , * __result = NULL ;
168
144
169
145
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
170
146
"r" , & remote ) == FAILURE ) {
@@ -173,12 +149,10 @@ PHP_FUNCTION(git_remote_owner)
173
149
174
150
ZEND_FETCH_RESOURCE (_remote , php_git2_t * , & remote , -1 , PHP_GIT2_RESOURCE_NAME , git2_resource_handle );
175
151
result = git_remote_owner (PHP_GIT2_V (_remote , remote ));
176
- PHP_GIT2_MAKE_RESOURCE (__result );
177
- PHP_GIT2_V (__result , remote ) = remote ;
178
- __result -> type = PHP_GIT2_TYPE_REPOSITORY ;
179
- __result -> resource_id = PHP_GIT2_LIST_INSERT (result , git2_resource_handle );
180
- __result -> should_free_v = 0 ;
181
- ZVAL_RESOURCE (return_value , __result -> resource_id );
152
+ if (php_git2_make_resource (& __result , PHP_GIT2_TYPE_REMOTE , result , 1 TSRMLS_CC )) {
153
+ RETURN_FALSE ;
154
+ }
155
+ ZVAL_RESOURCE (return_value , GIT2_RVAL_P (__result ));
182
156
}
183
157
/* }}} */
184
158
@@ -820,43 +794,43 @@ PHP_FUNCTION(git_remote_stats)
820
794
/* }}} */
821
795
822
796
823
- /* {{{ proto resource git_remote_autotag(remote)
824
- */
797
+ /* {{{ proto resource git_remote_autotag(resource $ remote)
798
+ */
825
799
PHP_FUNCTION (git_remote_autotag )
826
800
{
827
- zval * remote ;
828
- php_git2_t * _remote ;
829
-
830
- /* TODO(chobie): implement this */
831
- php_error_docref (NULL TSRMLS_CC , E_WARNING , "git_remote_autotag not implemented yet" );
832
- return ;
801
+ git_remote_autotag_option_t * result = NULL ;
802
+ zval * remote = NULL ;
803
+ php_git2_t * _remote = NULL ;
833
804
834
805
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
835
806
"r" , & remote ) == FAILURE ) {
836
807
return ;
837
808
}
809
+
838
810
ZEND_FETCH_RESOURCE (_remote , php_git2_t * , & remote , -1 , PHP_GIT2_RESOURCE_NAME , git2_resource_handle );
811
+ result = git_remote_autotag (PHP_GIT2_V (_remote , remote ));
812
+ /* TODO(chobie): implement this */
839
813
}
814
+ /* }}} */
840
815
841
- /* {{{ proto void git_remote_set_autotag(remote, value)
842
- */
816
+ /* {{{ proto void git_remote_set_autotag(resource $ remote, $ value)
817
+ */
843
818
PHP_FUNCTION (git_remote_set_autotag )
844
819
{
845
- zval * remote ;
846
- php_git2_t * _remote ;
847
- zval * value ;
848
- php_git2_t * _value ;
849
-
850
- /* TODO(chobie): implement this */
851
- php_error_docref (NULL TSRMLS_CC , E_WARNING , "git_remote_set_autotag not implemented yet" );
852
- return ;
820
+ zval * remote = NULL , * value = NULL ;
821
+ php_git2_t * _remote = NULL ;
853
822
823
+ /* TODO(chobie):impelement this */
854
824
if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
855
- "rr " , & remote , & value ) == FAILURE ) {
825
+ "r<git_remote_autotag_option_t> " , & remote , & value ) == FAILURE ) {
856
826
return ;
857
827
}
828
+
858
829
ZEND_FETCH_RESOURCE (_remote , php_git2_t * , & remote , -1 , PHP_GIT2_RESOURCE_NAME , git2_resource_handle );
830
+ git_remote_set_autotag (PHP_GIT2_V (_remote , remote ), value );
859
831
}
832
+ /* }}} */
833
+
860
834
861
835
/* {{{ proto long git_remote_rename(remote, new_name, callback, payload)
862
836
*/
0 commit comments