Make lots of string pointers const (#10646)

This allows using string literals without implicitly casting away the
`const`.
This commit is contained in:
Max Kellermann 2023-02-21 15:01:37 +01:00 committed by GitHub
parent 373809c51b
commit 263b22f374
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 39 additions and 40 deletions

View file

@ -97,7 +97,7 @@ void zend_shared_alloc_create_lock(char *lockfile_path)
}
#endif
static void no_memory_bailout(size_t allocate_size, char *error)
static void no_memory_bailout(size_t allocate_size, const char *error)
{
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Unable to allocate shared memory segment of %zu bytes: %s: %s (%d)", allocate_size, error?error:"unknown", strerror(errno), errno );
}
@ -117,7 +117,7 @@ static void copy_shared_segments(void *to, void *from, int count, int size)
}
}
static int zend_shared_alloc_try(const zend_shared_memory_handler_entry *he, size_t requested_size, zend_shared_segment ***shared_segments_p, int *shared_segments_count, char **error_in)
static int zend_shared_alloc_try(const zend_shared_memory_handler_entry *he, size_t requested_size, zend_shared_segment ***shared_segments_p, int *shared_segments_count, const char **error_in)
{
int res;
g_shared_alloc_handler = he->handler;
@ -151,7 +151,7 @@ int zend_shared_alloc_startup(size_t requested_size, size_t reserved_size)
zend_shared_segment **tmp_shared_segments;
size_t shared_segments_array_size;
zend_smm_shared_globals tmp_shared_globals, *p_tmp_shared_globals;
char *error_in = NULL;
const char *error_in = NULL;
const zend_shared_memory_handler_entry *he;
int res = ALLOC_FAILURE;
int i;
@ -169,7 +169,7 @@ int zend_shared_alloc_startup(size_t requested_size, size_t reserved_size)
#endif
if (ZCG(accel_directives).memory_model && ZCG(accel_directives).memory_model[0]) {
char *model = ZCG(accel_directives).memory_model;
const char *model = ZCG(accel_directives).memory_model;
/* "cgi" is really "shm"... */
if (strncmp(ZCG(accel_directives).memory_model, "cgi", sizeof("cgi")) == 0) {
model = "shm";