diff options
author | Victor Stinner <vstinner@redhat.com> | 2018-08-01 15:56:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-01 15:56:14 (GMT) |
commit | 6c785c0ebdadc84d80a53d896c38fd7ada8ae1f6 (patch) | |
tree | 9f87d1708dd9895c78b5ac7d1b9bc31aa835e48f /Python/bootstrap_hash.c | |
parent | cfc8831f5ed607048679427f7d76d6cb4f8a2e8a (diff) | |
download | cpython-6c785c0ebdadc84d80a53d896c38fd7ada8ae1f6.zip cpython-6c785c0ebdadc84d80a53d896c38fd7ada8ae1f6.tar.gz cpython-6c785c0ebdadc84d80a53d896c38fd7ada8ae1f6.tar.bz2 |
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
Diffstat (limited to 'Python/bootstrap_hash.c')
-rw-r--r-- | Python/bootstrap_hash.c | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/Python/bootstrap_hash.c b/Python/bootstrap_hash.c index 073b2ea..7b187f1 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) |