-
Notifications
You must be signed in to change notification settings - Fork 7.9k
php_reflection.c: make a bunch of pointers const
#15927
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
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more question: Based on what rules did you add
const
? It seems a bit arbitrary to add it forzend_extension
, but notzend_function
,zval
, etc. I don't object about these changes in general, but I'm not sure it makes sense to touch all functions just to add them, at least not unless we can show that there's some code-generation benefit from it. In this isolated context, the changes look fine.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added as many as I could
E.g. for
_const_string
, thezval *value
gets passed tozval_get_tmp_string()
which requires a non-constzval
, since (digging deeper into the call stack) forIS_STRING
values the reference count is increased, which needs non-constant inputsFor
_function_string
, the function pointer is passed to_function_parameter_string()
and from there to_parameter_string()
which needs to cast it to(zend_op_array*)
, so a non-constant input is neededIf this (and a few other smaller test patches I was going to send, the next being for zend_enum.c) were accepted, I would then file a task/start a discussion for doing this all over the place. E.g., if
zend_string_dup()
gets changed to get a constant pointer, then anything that calls (and doesn't need a non-constant pointer for anything else), and so on, bubbling up.