Skip to content

Remove unnecassry Zend API macros #6029

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

Closed
wants to merge 14 commits into from

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Aug 21, 2020

This PR removes APIs provided by Zend via macros as a compatibility layer or to cover up unused arguments.

The only one which had some usage other than zend_hash_init_ex() is zval_dtor() whose expansion is zval_ptr_dtor_nogc() which seems rather strange and I suppose they should use zval_ptr_dtor() for the most part.

@nikic
Copy link
Member

nikic commented Aug 24, 2020

I'd prefer to keep the zval_dtor alias, it used to be used quite heavily.

@Girgias Girgias force-pushed the refactor-zend-useless-apis branch from b7972a9 to 2f82eb9 Compare August 24, 2020 12:22
@@ -699,7 +699,7 @@ ZEND_API zend_ast *zend_compile_string_to_ast(
zend_restore_lexical_state(&original_lex_state);
CG(in_compilation) = original_in_compilation;

zval_dtor(&code_zv);
zval_ptr_dtor_nogc(&code_zv);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well use zval_ptr_dtor_str(&code_zv)

@@ -2597,10 +2597,10 @@ getvalue(struct magic_set *ms, struct magic *m, const char **p, int action)
convert_libmagic_pattern(&pattern, m->value.s, strlen(m->value.s), options);

if ((pce = pcre_get_compiled_regex_cache(Z_STR(pattern))) == NULL) {
zval_dtor(&pattern);
zval_ptr_dtor_nogc(&pattern);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it would be even better if convert_libmagic_pattern were changed to return zend_string*. There's no point in going through a zval here.

win32/signal.c Outdated
@@ -110,7 +110,7 @@ PHP_FUNCTION(sapi_windows_set_ctrl_handler)
}

if (!ZEND_FCI_INITIALIZED(fci)) {
zval_dtor(&ctrl_handler);
zval_ptr_dtor_nogc(&ctrl_handler);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use just zval_ptr_dtor. Might be circular.

@Girgias Girgias force-pushed the refactor-zend-useless-apis branch from 2f82eb9 to 61932ff Compare August 25, 2020 13:21
@php-pulls php-pulls closed this in 1b2ec73 Aug 26, 2020
@Girgias Girgias deleted the refactor-zend-useless-apis branch August 26, 2020 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants