Commit 778928b0 authored by INADA Naoki's avatar INADA Naoki Committed by GitHub

bpo-29304: Simplify dict lookup functions (GH-2407)

* remove hashpos parameter from lookdict functions.
* remove many duplicated code from lookdict functions.
parent 87c3c5de
......@@ -12,8 +12,7 @@ typedef struct {
* -1 when no entry found, -3 when compare raises error.
*/
typedef Py_ssize_t (*dict_lookup_func)
(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject **value_addr,
Py_ssize_t *hashpos);
(PyDictObject *mp, PyObject *key, Py_hash_t hash, PyObject **value_addr);
#define DKIX_EMPTY (-1)
#define DKIX_DUMMY (-2) /* Used internally */
......
This diff is collapsed.
......@@ -546,7 +546,7 @@ _odict_get_index_raw(PyODictObject *od, PyObject *key, Py_hash_t hash)
PyDictKeysObject *keys = ((PyDictObject *)od)->ma_keys;
Py_ssize_t ix;
ix = (keys->dk_lookup)((PyDictObject *)od, key, hash, &value, NULL);
ix = (keys->dk_lookup)((PyDictObject *)od, key, hash, &value);
if (ix == DKIX_EMPTY) {
return keys->dk_nentries; /* index of new entry */
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment