@@ -69,26 +69,26 @@ PHP_FUNCTION(git_revwalk_push)
6969}
7070/* }}} */
7171
72-
73- /* {{{ proto long git_revwalk_push_glob(walk, glob)
74- */
72+ /* {{{ proto long git_revwalk_push_glob(resource $walk, string $glob)
73+ */
7574PHP_FUNCTION (git_revwalk_push_glob )
7675{
77- zval * walk ;
78- php_git2_t * _walk ;
79- char * glob = {0 };
80- int glob_len ;
81-
82- /* TODO(chobie): implement this */
83- php_error_docref (NULL TSRMLS_CC , E_WARNING , "git_revwalk_push_glob not implemented yet" );
84- return ;
76+ int result = 0 , glob_len = 0 , error = 0 ;
77+ zval * walk = NULL ;
78+ php_git2_t * _walk = NULL ;
79+ char * glob = NULL ;
8580
8681 if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
8782 "rs" , & walk , & glob , & glob_len ) == FAILURE ) {
8883 return ;
8984 }
85+
9086 ZEND_FETCH_RESOURCE (_walk , php_git2_t * , & walk , -1 , PHP_GIT2_RESOURCE_NAME , git2_resource_handle );
87+ result = git_revwalk_push_glob (PHP_GIT2_V (_walk , revwalk ), glob );
88+ RETURN_LONG (result );
9189}
90+ /* }}} */
91+
9292
9393/* {{{ proto long git_revwalk_push_head(walk)
9494*/
@@ -142,25 +142,26 @@ PHP_FUNCTION(git_revwalk_hide)
142142
143143}
144144
145- /* {{{ proto long git_revwalk_hide_glob(walk, glob)
146- */
145+ /* {{{ proto long git_revwalk_hide_glob(resource $ walk, string $ glob)
146+ */
147147PHP_FUNCTION (git_revwalk_hide_glob )
148148{
149- zval * walk ;
150- php_git2_t * _walk ;
151- char * glob = {0 };
152- int glob_len ;
153-
154- /* TODO(chobie): implement this */
155- php_error_docref (NULL TSRMLS_CC , E_WARNING , "git_revwalk_hide_glob not implemented yet" );
156- return ;
149+ int result = 0 , glob_len = 0 , error = 0 ;
150+ zval * walk = NULL ;
151+ php_git2_t * _walk = NULL ;
152+ char * glob = NULL ;
157153
158154 if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
159155 "rs" , & walk , & glob , & glob_len ) == FAILURE ) {
160156 return ;
161157 }
158+
162159 ZEND_FETCH_RESOURCE (_walk , php_git2_t * , & walk , -1 , PHP_GIT2_RESOURCE_NAME , git2_resource_handle );
160+ result = git_revwalk_hide_glob (PHP_GIT2_V (_walk , revwalk ), glob );
161+ RETURN_LONG (result );
163162}
163+ /* }}} */
164+
164165
165166/* {{{ proto long git_revwalk_hide_head(walk)
166167*/
@@ -184,45 +185,47 @@ PHP_FUNCTION(git_revwalk_hide_head)
184185 }
185186}
186187
187- /* {{{ proto long git_revwalk_push_ref(walk, refname)
188- */
188+ /* {{{ proto long git_revwalk_push_ref(resource $ walk, string $ refname)
189+ */
189190PHP_FUNCTION (git_revwalk_push_ref )
190191{
191- zval * walk ;
192- php_git2_t * _walk ;
193- char * refname = {0 };
194- int refname_len ;
195-
196- /* TODO(chobie): implement this */
197- php_error_docref (NULL TSRMLS_CC , E_WARNING , "git_revwalk_push_ref not implemented yet" );
198- return ;
192+ int result = 0 , refname_len = 0 , error = 0 ;
193+ zval * walk = NULL ;
194+ php_git2_t * _walk = NULL ;
195+ char * refname = NULL ;
199196
200197 if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
201198 "rs" , & walk , & refname , & refname_len ) == FAILURE ) {
202199 return ;
203200 }
201+
204202 ZEND_FETCH_RESOURCE (_walk , php_git2_t * , & walk , -1 , PHP_GIT2_RESOURCE_NAME , git2_resource_handle );
203+ result = git_revwalk_push_ref (PHP_GIT2_V (_walk , revwalk ), refname );
204+ RETURN_LONG (result );
205205}
206+ /* }}} */
206207
207- /* {{{ proto long git_revwalk_hide_ref(walk, refname)
208- */
208+
209+ /* {{{ proto long git_revwalk_hide_ref(resource $walk, string $refname)
210+ */
209211PHP_FUNCTION (git_revwalk_hide_ref )
210212{
211- zval * walk ;
212- php_git2_t * _walk ;
213- char * refname = {0 };
214- int refname_len ;
215-
216- /* TODO(chobie): implement this */
217- php_error_docref (NULL TSRMLS_CC , E_WARNING , "git_revwalk_hide_ref not implemented yet" );
218- return ;
213+ int result = 0 , refname_len = 0 , error = 0 ;
214+ zval * walk = NULL ;
215+ php_git2_t * _walk = NULL ;
216+ char * refname = NULL ;
219217
220218 if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
221219 "rs" , & walk , & refname , & refname_len ) == FAILURE ) {
222220 return ;
223221 }
222+
224223 ZEND_FETCH_RESOURCE (_walk , php_git2_t * , & walk , -1 , PHP_GIT2_RESOURCE_NAME , git2_resource_handle );
224+ result = git_revwalk_hide_ref (PHP_GIT2_V (_walk , revwalk ), refname );
225+ RETURN_LONG (result );
225226}
227+ /* }}} */
228+
226229
227230/* {{{ proto string git_revwalk_next(walk)
228231*/
@@ -267,25 +270,26 @@ PHP_FUNCTION(git_revwalk_sorting)
267270 git_revwalk_sorting (PHP_GIT2_V (_walk , revwalk ), sort_mode );
268271}
269272
270- /* {{{ proto long git_revwalk_push_range(walk, range)
271- */
273+ /* {{{ proto long git_revwalk_push_range(resource $ walk, string $ range)
274+ */
272275PHP_FUNCTION (git_revwalk_push_range )
273276{
274- zval * walk ;
275- php_git2_t * _walk ;
276- char * range = {0 };
277- int range_len ;
278-
279- /* TODO(chobie): implement this */
280- php_error_docref (NULL TSRMLS_CC , E_WARNING , "git_revwalk_push_range not implemented yet" );
281- return ;
277+ int result = 0 , range_len = 0 , error = 0 ;
278+ zval * walk = NULL ;
279+ php_git2_t * _walk = NULL ;
280+ char * range = NULL ;
282281
283282 if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
284283 "rs" , & walk , & range , & range_len ) == FAILURE ) {
285284 return ;
286285 }
286+
287287 ZEND_FETCH_RESOURCE (_walk , php_git2_t * , & walk , -1 , PHP_GIT2_RESOURCE_NAME , git2_resource_handle );
288+ result = git_revwalk_push_range (PHP_GIT2_V (_walk , revwalk ), range );
289+ RETURN_LONG (result );
288290}
291+ /* }}} */
292+
289293
290294/* {{{ proto void git_revwalk_simplify_first_parent(walk)
291295*/
@@ -303,24 +307,27 @@ PHP_FUNCTION(git_revwalk_simplify_first_parent)
303307 git_revwalk_simplify_first_parent (PHP_GIT2_V (_walk , revwalk ));
304308}
305309
306- /* {{{ proto void git_revwalk_free(walk)
307- */
310+ /* {{{ proto void git_revwalk_free(resource $ walk)
311+ */
308312PHP_FUNCTION (git_revwalk_free )
309313{
310- zval * walk ;
311- php_git2_t * _walk ;
314+ zval * walk = NULL ;
315+ php_git2_t * _walk = NULL ;
312316
313317 if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC ,
314318 "r" , & walk ) == FAILURE ) {
315319 return ;
316320 }
317- ZEND_FETCH_RESOURCE (_walk , php_git2_t * , & walk , -1 , PHP_GIT2_RESOURCE_NAME , git2_resource_handle );
318321
319- if (_walk -> should_free_v ) {
322+ ZEND_FETCH_RESOURCE (_walk , php_git2_t * , & walk , -1 , PHP_GIT2_RESOURCE_NAME , git2_resource_handle );
323+ if (GIT2_SHOULD_FREE (_walk )) {
320324 git_revwalk_free (PHP_GIT2_V (_walk , revwalk ));
321- }
325+ GIT2_SHOULD_FREE (_walk ) = 0 ;
326+ };
322327 zval_ptr_dtor (& walk );
323328}
329+ /* }}} */
330+
324331
325332/* {{{ proto resource git_revwalk_repository(walk)
326333*/
@@ -337,12 +344,9 @@ PHP_FUNCTION(git_revwalk_repository)
337344 ZEND_FETCH_RESOURCE (_walk , php_git2_t * , & walk , -1 , PHP_GIT2_RESOURCE_NAME , git2_resource_handle );
338345
339346 repository = git_revwalk_repository (PHP_GIT2_V (_walk , revwalk ));
340-
341- PHP_GIT2_MAKE_RESOURCE (result );
342- PHP_GIT2_V (result , repository ) = repository ;
343- result -> type = PHP_GIT2_TYPE_REPOSITORY ;
344- result -> resource_id = PHP_GIT2_LIST_INSERT (result , git2_resource_handle );
345- result -> should_free_v = 0 ;
347+ if (php_git2_make_resource (& result , PHP_GIT2_TYPE_REPOSITORY , repository , 0 TSRMLS_CC )) {
348+ RETURN_FALSE ;
349+ }
346350
347351 ZVAL_RESOURCE (return_value , result -> resource_id );
348352}
0 commit comments