-
Notifications
You must be signed in to change notification settings - Fork 8k
zend_API: Add Z_PARAM_ENUM_NAME() #20898
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
base: master
Are you sure you want to change the base?
Conversation
It is becoming increasingly common to have enum parameters on internal functions. Manually turning the singleton enum object into the case name is verbose, especially for optional parameters. Add a new `Z_PARAM_ENUM_NAME()` helper to directly retrieve the case name.
873e4c7 to
43e9fd5
Compare
Girgias
left a comment
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.
Makes sense to me. Just a few questions regarding const qualifiers.
| php_random_randomizer *randomizer = Z_RANDOM_RANDOMIZER_P(ZEND_THIS); | ||
| double min, max; | ||
| zend_object *bounds = NULL; | ||
| zend_string *bounds = NULL; |
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.
Why not mark this as const as you did with other usages?
| zend_string *bounds = NULL; | |
| const zend_string *bounds = NULL; |
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.
Probably related to the order of replacements I made some file reminded me that this could be const. I'll fix this up before merging.
| PHP_FUNCTION(pcntl_setqos_class) | ||
| { | ||
| zval *qos_obj; | ||
| zend_string *qos; |
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.
Ditto
| zend_string *qos; | |
| const zend_string *qos; |
ndossche
left a comment
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.
No further remarks from my side. This is nicer.
I wonder whether we should also add the _OR_NULL & _EX variants etc.
I feel that a nullable enum is something that is rarely needed, since the "null case" could just be part of the enum with a proper name. |
It is becoming increasingly common to have enum parameters on internal functions. Manually turning the singleton enum object into the case name is verbose, especially for optional parameters.
Add a new
Z_PARAM_ENUM_NAME()helper to directly retrieve the case name.