Patch spl_dllist_clear for SPL related Bug #60759
Patch version 2012-01-15 22:37 UTC
Return to Bug #60759 |
Download this patch
Patch Revisions:
Developer: dragoonis@php.net
Index: ext/spl/spl_dllist.c
===================================================================
--- ext/spl/spl_dllist.c (revision 322340)
+++ ext/spl/spl_dllist.c (working copy)
@@ -596,6 +596,29 @@
}
/* }}} */
+/* {{{ proto bool SplDoublyLinkedList::clear() U
+ Clear the SplDoublyLinkedList datastructure */
+SPL_METHOD(SplDoublyLinkedList, clear)
+{
+
+ zval *tmp = NULL;
+ spl_dllist_object *intern;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ intern = (spl_dllist_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
+
+ while (intern->llist->count > 0) {
+ tmp = (zval *)spl_ptr_llist_pop(intern->llist TSRMLS_CC);
+ zval_ptr_dtor(&tmp);
+ }
+
+ RETURN_TRUE;
+}
+/* }}} */
+
/* {{{ proto mixed SplDoublyLinkedList::pop() U
Pop an element out of the SplDoublyLinkedList */
SPL_METHOD(SplDoublyLinkedList, pop)
@@ -1306,6 +1329,7 @@
};
static const zend_function_entry spl_funcs_SplDoublyLinkedList[] = {
+ SPL_ME(SplDoublyLinkedList, clear, arginfo_dllist_void, ZEND_ACC_PUBLIC)
SPL_ME(SplDoublyLinkedList, pop, arginfo_dllist_void, ZEND_ACC_PUBLIC)
SPL_ME(SplDoublyLinkedList, shift, arginfo_dllist_void, ZEND_ACC_PUBLIC)
SPL_ME(SplDoublyLinkedList, push, arginfo_dllist_push, ZEND_ACC_PUBLIC)
|