bpo-32241: Add the const qualifire to declarations of umodifiable strings. (#4748)

This commit is contained in:
Serhiy Storchaka 2017-12-12 13:55:04 +02:00 committed by GitHub
parent 5ce0a2a100
commit 4ae06c5337
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 59 additions and 56 deletions

View file

@ -533,16 +533,16 @@ _PyOS_URandomNonblock(void *buffer, Py_ssize_t size)
return pyurandom(buffer, size, 0, 1);
}
int Py_ReadHashSeed(char *seed_text,
int Py_ReadHashSeed(const char *seed_text,
int *use_hash_seed,
unsigned long *hash_seed)
{
Py_BUILD_ASSERT(sizeof(_Py_HashSecret_t) == sizeof(_Py_HashSecret.uc));
/* Convert a text seed to a numeric one */
if (seed_text && *seed_text != '\0' && strcmp(seed_text, "random") != 0) {
char *endptr = seed_text;
const char *endptr = seed_text;
unsigned long seed;
seed = strtoul(seed_text, &endptr, 10);
seed = strtoul(seed_text, (char **)&endptr, 10);
if (*endptr != '\0'
|| seed > 4294967295UL
|| (errno == ERANGE && seed == ULONG_MAX))
@ -604,7 +604,7 @@ init_hash_secret(int use_hash_seed,
_PyInitError
_Py_HashRandomization_Init(_PyCoreConfig *core_config)
{
char *seed_text;
const char *seed_text;
int use_hash_seed = core_config->use_hash_seed;
unsigned long hash_seed = core_config->hash_seed;