From 6c785c0ebdadc84d80a53d896c38fd7ada8ae1f6 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 1 Aug 2018 17:56:14 +0200 Subject: bpo-34170: Add Python/coreconfig.c for _PyCoreConfig (GH-8607) * Add Include/coreconfig.h * Move config_*() and _PyCoreConfig_*() functions from Modules/main.c to a new Python/coreconfig.c file. * Inline _Py_ReadHashSeed() into config_init_hash_seed() * Move global configuration variables to coreconfig.c --- Python/bootstrap_hash.c | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'Python/bootstrap_hash.c') diff --git a/Python/bootstrap_hash.c b/Python/bootstrap_hash.c index 073b2ea8db..7b187f1887 100644 --- a/Python/bootstrap_hash.c +++ b/Python/bootstrap_hash.c @@ -538,35 +538,6 @@ _PyOS_URandomNonblock(void *buffer, Py_ssize_t size) return pyurandom(buffer, size, 0, 1); } -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) { - const char *endptr = seed_text; - unsigned long seed; - seed = strtoul(seed_text, (char **)&endptr, 10); - if (*endptr != '\0' - || seed > 4294967295UL - || (errno == ERANGE && seed == ULONG_MAX)) - { - return -1; - } - /* Use a specific hash */ - *use_hash_seed = 1; - *hash_seed = seed; - } - else { - /* Use a random hash */ - *use_hash_seed = 0; - *hash_seed = 0; - } - return 0; -} - _PyInitError _Py_HashRandomization_Init(const _PyCoreConfig *config) -- cgit v1.2.1