-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Constify char* arguments of APIs #5676
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
Closed
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f7ddeaf
Constify char* arguments of APIs
twose 099c034
Fix compilation on WIN (apply the patch from @cmb69)
twose b9b9685
Constify hdr
twose caafc3d
Optimizations
twose 4dd44bc
Constify more API char* arguments
twose 5210949
Constify char* arguments of SAPIs
twose 9698bf7
Fix orig_getenv
twose b4ad3cf
Do not drop const qualifier
twose 19c00d6
Fix OpenSSL compilation
twose 99a1dd0
Fix PCRE compilation
twose 32fc777
Fix SAPI compilation
twose 0c01dbf
Fix PDO compilation
twose e82bf5e
Fix PHAR compilation
twose 17ed118
Fix head compilation
twose 1e6128b
Fix getenv function
twose 67ab3cf
Fix SAPI compilation again
twose 23f5adb
Fix CLI server compilation
twose 92bc94e
Fix fcgi_apply_func
twose f07d66c
Fix PHPDBG compilation (phpdbg_parse_variable may modify the content …
twose 8f58f05
Fix sendmail on WIN
twose e72cab5
Make code more friendly
twose 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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -247,7 +247,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS); | |
PHPAPI int php_session_validate_sid(PS_VALIDATE_SID_ARGS); | ||
PHPAPI int php_session_update_timestamp(PS_UPDATE_TIMESTAMP_ARGS); | ||
|
||
PHPAPI void session_adapt_url(const char *, size_t, char **, size_t *); | ||
PHPAPI void session_adapt_url(const char *url, size_t urllen, char **new, size_t *newlen); | ||
twose marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
PHPAPI int php_session_destroy(void); | ||
PHPAPI void php_add_session_var(zend_string *name); | ||
|
@@ -260,12 +260,11 @@ PHPAPI int php_session_register_serializer(const char *name, | |
zend_string *(*encode)(PS_SERIALIZER_ENCODE_ARGS), | ||
int (*decode)(PS_SERIALIZER_DECODE_ARGS)); | ||
|
||
PHPAPI void php_session_set_id(char *id); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can not find any implementation of |
||
PHPAPI int php_session_start(void); | ||
PHPAPI int php_session_flush(int write); | ||
|
||
PHPAPI const ps_module *_php_find_ps_module(char *name); | ||
PHPAPI const ps_serializer *_php_find_ps_serializer(char *name); | ||
PHPAPI const ps_module *_php_find_ps_module(const char *name); | ||
PHPAPI const ps_serializer *_php_find_ps_serializer(const char *name); | ||
|
||
PHPAPI int php_session_valid_key(const char *key); | ||
PHPAPI int php_session_reset_id(void); | ||
|
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,7 +70,7 @@ PHPAPI PHP_FUNCTION(dl) | |
|
||
/* {{{ php_load_shlib | ||
*/ | ||
PHPAPI void *php_load_shlib(char *path, char **errp) | ||
PHPAPI void *php_load_shlib(const char *path, char **errp) | ||
{ | ||
void *handle; | ||
char *err; | ||
|
@@ -98,7 +98,7 @@ PHPAPI void *php_load_shlib(char *path, char **errp) | |
|
||
/* {{{ php_load_extension | ||
*/ | ||
PHPAPI int php_load_extension(char *filename, int type, int start_now) | ||
PHPAPI int php_load_extension(const char *filename, int type, int start_now) | ||
{ | ||
void *handle; | ||
char *libpath; | ||
|
@@ -243,35 +243,47 @@ PHPAPI int php_load_extension(char *filename, int type, int start_now) | |
} | ||
/* }}} */ | ||
|
||
/* {{{ php_dl | ||
*/ | ||
PHPAPI void php_dl(char *file, int type, zval *return_value, int start_now) | ||
#else | ||
|
||
static void php_dl_error(const char *filename) | ||
{ | ||
/* Load extension */ | ||
if (php_load_extension(file, type, start_now) == FAILURE) { | ||
RETVAL_FALSE; | ||
} else { | ||
RETVAL_TRUE; | ||
} | ||
php_error_docref(NULL, E_WARNING, "Cannot dynamically load %s - dynamic modules are not supported", filename); | ||
} | ||
/* }}} */ | ||
|
||
PHP_MINFO_FUNCTION(dl) | ||
PHPAPI void *php_load_shlib(const char *path, char **errp) | ||
{ | ||
php_info_print_table_row(2, "Dynamic Library Support", "enabled"); | ||
php_dl_error(filename); | ||
(*errp) = estrdup("No DL support"); | ||
} | ||
|
||
#else | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Notice: missing function implementations here, so I made some changes |
||
|
||
PHPAPI void php_dl(char *file, int type, zval *return_value, int start_now) | ||
PHPAPI int php_load_extension(const char *filename, int type, int start_now) | ||
{ | ||
php_error_docref(NULL, E_WARNING, "Cannot dynamically load %s - dynamic modules are not supported", file); | ||
RETVAL_FALSE; | ||
php_dl_error(filename); | ||
|
||
return FAILURE; | ||
} | ||
|
||
PHP_MINFO_FUNCTION(dl) | ||
#endif | ||
|
||
/* {{{ php_dl | ||
*/ | ||
PHPAPI void php_dl(const char *file, int type, zval *return_value, int start_now) | ||
{ | ||
PUTS("Dynamic Library support not available<br />.\n"); | ||
/* Load extension */ | ||
if (php_load_extension(file, type, start_now) == FAILURE) { | ||
RETVAL_FALSE; | ||
} else { | ||
RETVAL_TRUE; | ||
} | ||
} | ||
/* }}} */ | ||
|
||
PHP_MINFO_FUNCTION(dl) | ||
{ | ||
#if defined(HAVE_LIBDL) | ||
#define PHP_DL_SUPPORT_STATUS "enabled" | ||
#else | ||
#define PHP_DL_SUPPORT_STATUS "unavailable" | ||
#endif | ||
php_info_print_table_row(2, "Dynamic Library Support", PHP_DL_SUPPORT_STATUS); | ||
} |
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.
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.
Could you please also submit a PR to https://github.com/derickr/timelib, so we can drop these const casts in the future?
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 did not change it because I was worried whether this modification will affect other projects
but I will try to submit a PR soon
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.
Added
TODO
commentThere 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.
@nikic @derickr done: derickr/timelib#82