-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add const modifier for zend_extension #6462
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
Add const modifier for zend_extension #6462
Conversation
|
sapi/phpdbg/phpdbg_prompt.c
Outdated
@@ -1386,7 +1386,7 @@ PHPDBG_COMMAND(dl) /* {{{ */ | |||
path = estrndup(param->str, param->len); | |||
|
|||
phpdbg_activate_err_buf(1); | |||
if ((type = phpdbg_load_module_or_extension(&path, &name)) == NULL) { | |||
if ((type = phpdbg_load_module_or_extension(&path, (const char **) &name)) == 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.
Heh, we're nearly there! Now, changing char *name
to const char *name
in the variable declaration above should allow us to avoid casts completely if I see it right.
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.
Heh, we're nearly there! Now, changing
char *name
toconst char *name
in the variable declaration above should allow us to avoid casts completely if I see it right.
ha, but we should convert efree(name);
:
/Users/hantaohuang/codeDir/cCode/php-src/sapi/phpdbg/phpdbg_prompt.c:1391:5: warning: passing 'const char *' to parameter of type 'void *' discards qualifiers
[-Wincompatible-pointer-types-discards-qualifiers]
efree(name);
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 think this call to efree
is actually a bug. The name should not be freed. (It also looks like the whole dl
command is effectively dead code right now, because it's not exposed to users.)
So I think you can simply drop this call.
There are some compile warning