Skip to content

Stop including php_pcre.h from spl_iterators.h #8290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions ext/spl/spl_iterators.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "ext/standard/info.h"
#include "zend_exceptions.h"
#include "zend_interfaces.h"
#include "ext/pcre/php_pcre.h"

#include "php_spl.h"
#include "spl_functions.h"
Expand Down Expand Up @@ -113,6 +114,53 @@ typedef struct _spl_recursive_it_iterator {
zend_object_iterator intern;
} spl_recursive_it_iterator;

typedef struct _spl_cbfilter_it_intern {
zend_fcall_info fci;
zend_fcall_info_cache fcc;
zend_object *object;
} _spl_cbfilter_it_intern;

typedef struct _spl_dual_it_object {
struct {
zval zobject;
zend_class_entry *ce;
zend_object *object;
zend_object_iterator *iterator;
} inner;
struct {
zval data;
zval key;
zend_long pos;
} current;
dual_it_type dit_type;
union {
struct {
zend_long offset;
zend_long count;
} limit;
struct {
zend_long flags; /* CIT_* */
zend_string *zstr;
zval zchildren;
zval zcache;
} caching;
struct {
zval zarrayit;
zend_object_iterator *iterator;
} append;
struct {
zend_long flags;
zend_long preg_flags;
pcre_cache_entry *pce;
zend_string *regex;
regex_mode mode;
int use_flags;
} regex;
_spl_cbfilter_it_intern *cbfilter;
} u;
zend_object std;
} spl_dual_it_object;

static zend_object_handlers spl_handlers_rec_it_it;
static zend_object_handlers spl_handlers_dual_it;

Expand All @@ -123,6 +171,12 @@ static inline spl_recursive_it_object *spl_recursive_it_from_obj(zend_object *ob

#define Z_SPLRECURSIVE_IT_P(zv) spl_recursive_it_from_obj(Z_OBJ_P((zv)))

static inline spl_dual_it_object *spl_dual_it_from_obj(zend_object *obj) /* {{{ */ {
return (spl_dual_it_object*)((char*)(obj) - XtOffsetOf(spl_dual_it_object, std));
} /* }}} */

#define Z_SPLDUAL_IT_P(zv) spl_dual_it_from_obj(Z_OBJ_P((zv)))

#define SPL_FETCH_AND_CHECK_DUAL_IT(var, objzval) \
do { \
spl_dual_it_object *it = Z_SPLDUAL_IT_P(objzval); \
Expand Down
54 changes: 0 additions & 54 deletions ext/spl/spl_iterators.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include "php.h"
#include "php_spl.h"
#include "ext/pcre/php_pcre.h"

extern PHPAPI zend_class_entry *spl_ce_AppendIterator;
extern PHPAPI zend_class_entry *spl_ce_CachingIterator;
Expand Down Expand Up @@ -99,59 +98,6 @@ typedef enum {
REGIT_MODE_MAX
} regex_mode;

typedef struct _spl_cbfilter_it_intern {
zend_fcall_info fci;
zend_fcall_info_cache fcc;
zend_object *object;
} _spl_cbfilter_it_intern;

typedef struct _spl_dual_it_object {
struct {
zval zobject;
zend_class_entry *ce;
zend_object *object;
zend_object_iterator *iterator;
} inner;
struct {
zval data;
zval key;
zend_long pos;
} current;
dual_it_type dit_type;
union {
struct {
zend_long offset;
zend_long count;
} limit;
struct {
zend_long flags; /* CIT_* */
zend_string *zstr;
zval zchildren;
zval zcache;
} caching;
struct {
zval zarrayit;
zend_object_iterator *iterator;
} append;
struct {
zend_long flags;
zend_long preg_flags;
pcre_cache_entry *pce;
zend_string *regex;
regex_mode mode;
int use_flags;
} regex;
_spl_cbfilter_it_intern *cbfilter;
} u;
zend_object std;
} spl_dual_it_object;

static inline spl_dual_it_object *spl_dual_it_from_obj(zend_object *obj) /* {{{ */ {
return (spl_dual_it_object*)((char*)(obj) - XtOffsetOf(spl_dual_it_object, std));
} /* }}} */

#define Z_SPLDUAL_IT_P(zv) spl_dual_it_from_obj(Z_OBJ_P((zv)))

typedef int (*spl_iterator_apply_func_t)(zend_object_iterator *iter, void *puser);

PHPAPI int spl_iterator_apply(zval *obj, spl_iterator_apply_func_t apply_func, void *puser);
Expand Down