Skip to content

Commit 8033c1b

Browse files
committed
Refactor out php_phongo_cursor_free()
1 parent 32b93db commit 8033c1b

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

src/MongoDB/Cursor.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ static void php_phongo_cursor_free_current(php_phongo_cursor_t *cursor) /* {{{ *
5858
}
5959
} /* }}} */
6060

61-
void php_phongo_cursor_free(php_phongo_cursor_t *cursor) /* {{{ */
62-
{
63-
if (cursor->cursor) {
64-
mongoc_cursor_destroy(cursor->cursor);
65-
cursor->cursor = NULL;
66-
}
67-
68-
php_phongo_cursor_free_current(cursor);
69-
} /* }}} */
70-
7161
/* {{{ Iterator handlers */
7262
static void php_phongo_cursor_iterator_dtor(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
7363
{
@@ -386,6 +376,10 @@ static void php_phongo_cursor_free_object(phongo_free_object_arg *object TSRMLS_
386376

387377
zend_object_std_dtor(&intern->std TSRMLS_CC);
388378

379+
if (intern->cursor) {
380+
mongoc_cursor_destroy(intern->cursor);
381+
}
382+
389383
if (intern->database) {
390384
efree(intern->database);
391385
}
@@ -406,7 +400,7 @@ static void php_phongo_cursor_free_object(phongo_free_object_arg *object TSRMLS_
406400
zval_ptr_dtor(&intern->read_preference);
407401
}
408402

409-
php_phongo_cursor_free(intern);
403+
php_phongo_cursor_free_current(intern);
410404

411405
zval_ptr_dtor(&intern->manager);
412406

0 commit comments

Comments
 (0)