diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2015-09-22 17:48:25 +0300 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2015-09-22 17:48:25 +0300 |
| commit | e45f67245aaf623935b7a4cabc6aa690ebfe7a7b (patch) | |
| tree | 1ea233a52d36fb1d1c619ca5764c97dd9248ee68 | |
| parent | e050412cdd833e64f5f06fa88ff84035c2501b76 (diff) | |
| download | php-git-e45f67245aaf623935b7a4cabc6aa690ebfe7a7b.tar.gz | |
Cleanup: don't keep useless dangling pointer
| -rw-r--r-- | ext/spl/spl_directory.c | 7 | ||||
| -rw-r--r-- | ext/spl/spl_directory.h | 11 |
2 files changed, 7 insertions, 11 deletions
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index eaaf609501..5090a0b1ac 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -122,10 +122,6 @@ static void spl_filesystem_object_free_storage(zend_object *object) /* {{{ */ spl_filesystem_file_free_line(intern); break; } - - if (intern->it) { - //????zend_iterator_dtor(&intern->it->intern); - } } /* }}} */ /* {{{ spl_ce_dir_object_new */ @@ -1646,8 +1642,7 @@ static void spl_filesystem_dir_it_dtor(zend_object_iterator *iter) zval_ptr_dtor(object); } /* Otherwise we were called from the owning object free storage handler as - * it sets - * iterator->intern.data to NULL. + * it sets iterator->intern.data to IS_UNDEF. * We don't even need to destroy iterator->current as we didn't add a * reference to it in move_forward or get_iterator */ } diff --git a/ext/spl/spl_directory.h b/ext/spl/spl_directory.h index dca463d6f0..5ad55abe87 100644 --- a/ext/spl/spl_directory.h +++ b/ext/spl/spl_directory.h @@ -101,7 +101,6 @@ struct _spl_filesystem_object { char escape; } file; } u; - spl_filesystem_iterator *it; zend_object std; }; @@ -114,10 +113,12 @@ static inline spl_filesystem_object *spl_filesystem_from_obj(zend_object *obj) / static inline spl_filesystem_iterator* spl_filesystem_object_to_iterator(spl_filesystem_object *obj) { - obj->it = ecalloc(1, sizeof(spl_filesystem_iterator)); - obj->it->object = (void *)obj; - zend_iterator_init(&obj->it->intern); - return obj->it; + spl_filesystem_iterator *it; + + it = ecalloc(1, sizeof(spl_filesystem_iterator)); + it->object = (void *)obj; + zend_iterator_init(&it->intern); + return it; } static inline spl_filesystem_object* spl_filesystem_iterator_to_object(spl_filesystem_iterator *it) |
