Lines Matching refs:od
517 #define _odictnode_VALUE(node, od) \ argument
518 PyODict_GetItemWithError((PyObject *)od, _odictnode_KEY(node))
522 #define _odict_FIRST(od) (((PyODictObject *)od)->od_first) argument
523 #define _odict_LAST(od) (((PyODictObject *)od)->od_last) argument
524 #define _odict_EMPTY(od) (_odict_FIRST(od) == NULL) argument
525 #define _odict_FOREACH(od, node) \ argument
526 for (node = _odict_FIRST(od); node != NULL; node = _odictnode_NEXT(node))
530 _odict_get_index_raw(PyODictObject *od, PyObject *key, Py_hash_t hash) in _odict_get_index_raw() argument
533 PyDictKeysObject *keys = ((PyDictObject *)od)->ma_keys; in _odict_get_index_raw()
536 ix = (keys->dk_lookup)((PyDictObject *)od, key, hash, &value); in _odict_get_index_raw()
548 _odict_resize(PyODictObject *od) in _odict_resize() argument
554 size = ((PyDictObject *)od)->ma_keys->dk_size; in _odict_resize()
564 _odict_FOREACH(od, node) { in _odict_resize()
565 i = _odict_get_index_raw(od, _odictnode_KEY(node), in _odict_resize()
575 PyMem_FREE(od->od_fast_nodes); in _odict_resize()
576 od->od_fast_nodes = fast_nodes; in _odict_resize()
577 od->od_fast_nodes_size = size; in _odict_resize()
578 od->od_resize_sentinel = ((PyDictObject *)od)->ma_keys; in _odict_resize()
584 _odict_get_index(PyODictObject *od, PyObject *key, Py_hash_t hash) in _odict_get_index() argument
589 keys = ((PyDictObject *)od)->ma_keys; in _odict_get_index()
592 if (od->od_resize_sentinel != keys || in _odict_get_index()
593 od->od_fast_nodes_size != keys->dk_size) { in _odict_get_index()
594 int resize_res = _odict_resize(od); in _odict_get_index()
599 return _odict_get_index_raw(od, key, hash); in _odict_get_index()
604 _odict_find_node_hash(PyODictObject *od, PyObject *key, Py_hash_t hash) in _odict_find_node_hash() argument
608 if (_odict_EMPTY(od)) in _odict_find_node_hash()
610 index = _odict_get_index(od, key, hash); in _odict_find_node_hash()
613 assert(od->od_fast_nodes != NULL); in _odict_find_node_hash()
614 return od->od_fast_nodes[index]; in _odict_find_node_hash()
618 _odict_find_node(PyODictObject *od, PyObject *key) in _odict_find_node() argument
623 if (_odict_EMPTY(od)) in _odict_find_node()
628 index = _odict_get_index(od, key, hash); in _odict_find_node()
631 assert(od->od_fast_nodes != NULL); in _odict_find_node()
632 return od->od_fast_nodes[index]; in _odict_find_node()
636 _odict_add_head(PyODictObject *od, _ODictNode *node) in _odict_add_head() argument
639 _odictnode_NEXT(node) = _odict_FIRST(od); in _odict_add_head()
640 if (_odict_FIRST(od) == NULL) in _odict_add_head()
641 _odict_LAST(od) = node; in _odict_add_head()
643 _odictnode_PREV(_odict_FIRST(od)) = node; in _odict_add_head()
644 _odict_FIRST(od) = node; in _odict_add_head()
645 od->od_state++; in _odict_add_head()
649 _odict_add_tail(PyODictObject *od, _ODictNode *node) in _odict_add_tail() argument
651 _odictnode_PREV(node) = _odict_LAST(od); in _odict_add_tail()
653 if (_odict_LAST(od) == NULL) in _odict_add_tail()
654 _odict_FIRST(od) = node; in _odict_add_tail()
656 _odictnode_NEXT(_odict_LAST(od)) = node; in _odict_add_tail()
657 _odict_LAST(od) = node; in _odict_add_tail()
658 od->od_state++; in _odict_add_tail()
663 _odict_add_new_node(PyODictObject *od, PyObject *key, Py_hash_t hash) in _odict_add_new_node() argument
669 i = _odict_get_index(od, key, hash); in _odict_add_new_node()
676 assert(od->od_fast_nodes != NULL); in _odict_add_new_node()
677 if (od->od_fast_nodes[i] != NULL) { in _odict_add_new_node()
693 _odict_add_tail(od, node); in _odict_add_new_node()
694 od->od_fast_nodes[i] = node; in _odict_add_new_node()
707 _odict_remove_node(PyODictObject *od, _ODictNode *node) in _odict_remove_node() argument
709 if (_odict_FIRST(od) == node) in _odict_remove_node()
710 _odict_FIRST(od) = _odictnode_NEXT(node); in _odict_remove_node()
714 if (_odict_LAST(od) == node) in _odict_remove_node()
715 _odict_LAST(od) = _odictnode_PREV(node); in _odict_remove_node()
721 od->od_state++; in _odict_remove_node()
741 _odict_clear_node(PyODictObject *od, _ODictNode *node, PyObject *key, in _odict_clear_node() argument
747 if (_odict_EMPTY(od)) { in _odict_clear_node()
752 i = _odict_get_index(od, key, hash); in _odict_clear_node()
756 assert(od->od_fast_nodes != NULL); in _odict_clear_node()
758 node = od->od_fast_nodes[i]; in _odict_clear_node()
759 assert(node == od->od_fast_nodes[i]); in _odict_clear_node()
766 od->od_fast_nodes[i] = NULL; in _odict_clear_node()
767 _odict_remove_node(od, node); in _odict_clear_node()
773 _odict_clear_nodes(PyODictObject *od) in _odict_clear_nodes() argument
777 PyMem_FREE(od->od_fast_nodes); in _odict_clear_nodes()
778 od->od_fast_nodes = NULL; in _odict_clear_nodes()
779 od->od_fast_nodes_size = 0; in _odict_clear_nodes()
780 od->od_resize_sentinel = NULL; in _odict_clear_nodes()
782 node = _odict_FIRST(od); in _odict_clear_nodes()
783 _odict_FIRST(od) = NULL; in _odict_clear_nodes()
784 _odict_LAST(od) = NULL; in _odict_clear_nodes()
834 odict_mp_ass_sub(PyODictObject *od, PyObject *v, PyObject *w) in odict_mp_ass_sub() argument
837 return PyODict_DelItem((PyObject *)od, v); in odict_mp_ass_sub()
839 return PyODict_SetItem((PyObject *)od, v, w); in odict_mp_ass_sub()
880 odict_sizeof(PyODictObject *od) in odict_sizeof() argument
882 Py_ssize_t res = _PyDict_SizeOf((PyDictObject *)od); in odict_sizeof()
883 res += sizeof(_ODictNode *) * od->od_fast_nodes_size; /* od_fast_nodes */ in odict_sizeof()
884 if (!_odict_EMPTY(od)) { in odict_sizeof()
885 res += sizeof(_ODictNode) * PyODict_SIZE(od); /* linked-list */ in odict_sizeof()
895 odict_reduce(register PyODictObject *od) in odict_reduce() argument
903 dict = _PyObject_GetAttrId((PyObject *)od, &PyId___dict__); in odict_reduce()
922 items = _PyObject_CallMethodIdObjArgs((PyObject *)od, &PyId_items, NULL); in odict_reduce()
931 result = PyTuple_Pack(5, Py_TYPE(od), args, dict ? dict : Py_None, Py_None, items_iter); in odict_reduce()
1008 odict_pop(PyObject *od, PyObject *args, PyObject *kwargs) in odict_pop() argument
1019 return _odict_popkey(od, key, failobj); in odict_pop()
1023 _odict_popkey_hash(PyObject *od, PyObject *key, PyObject *failobj, in _odict_popkey_hash() argument
1032 node = _odict_find_node_hash((PyODictObject *)od, key, hash); in _odict_popkey_hash()
1038 int res = _odict_clear_node((PyODictObject *)od, node, key, hash); in _odict_popkey_hash()
1045 if (PyODict_CheckExact(od)) { in _odict_popkey_hash()
1047 value = _PyDict_GetItem_KnownHash(od, key, hash); /* borrowed */ in _odict_popkey_hash()
1050 if (_PyDict_DelItem_KnownHash(od, key, hash) < 0) { in _odict_popkey_hash()
1058 int exists = PySequence_Contains(od, key); in _odict_popkey_hash()
1062 value = PyObject_GetItem(od, key); in _odict_popkey_hash()
1064 if (PyObject_DelItem(od, key) == -1) { in _odict_popkey_hash()
1086 _odict_popkey(PyObject *od, PyObject *key, PyObject *failobj) in _odict_popkey() argument
1092 return _odict_popkey_hash(od, key, failobj, hash); in _odict_popkey()
1139 static PyObject * odictkeys_new(PyObject *od); /* forward */
1146 static PyObject * odictvalues_new(PyObject *od); /* forward */
1153 static PyObject * odictitems_new(PyObject *od); /* forward */
1171 odict_clear(register PyODictObject *od, PyObject *Py_UNUSED(ignored)) in odict_clear() argument
1173 PyDict_Clear((PyObject *)od); in odict_clear()
1174 _odict_clear_nodes(od); in odict_clear()
1187 odict_copy(register PyODictObject *od) in odict_copy() argument
1192 if (PyODict_CheckExact(od)) in odict_copy()
1195 od_copy = _PyObject_CallNoArg((PyObject *)Py_TYPE(od)); in odict_copy()
1199 if (PyODict_CheckExact(od)) { in odict_copy()
1200 _odict_FOREACH(od, node) { in odict_copy()
1202 PyObject *value = _odictnode_VALUE(node, od); in odict_copy()
1214 _odict_FOREACH(od, node) { in odict_copy()
1216 PyObject *value = PyObject_GetItem((PyObject *)od, in odict_copy()
1246 odict_reversed(PyODictObject *od) in odict_reversed() argument
1248 return odictiter_new(od, _odict_ITER_KEYS|_odict_ITER_REVERSED); in odict_reversed()
1461 odict_traverse(PyODictObject *od, visitproc visit, void *arg) in odict_traverse() argument
1465 Py_VISIT(od->od_inst_dict); in odict_traverse()
1466 Py_VISIT(od->od_weakreflist); in odict_traverse()
1467 _odict_FOREACH(od, node) { in odict_traverse()
1470 return PyDict_Type.tp_traverse((PyObject *)od, visit, arg); in odict_traverse()
1476 odict_tp_clear(PyODictObject *od) in odict_tp_clear() argument
1478 Py_CLEAR(od->od_inst_dict); in odict_tp_clear()
1479 Py_CLEAR(od->od_weakreflist); in odict_tp_clear()
1480 PyDict_Clear((PyObject *)od); in odict_tp_clear()
1481 _odict_clear_nodes(od); in odict_tp_clear()
1525 odict_iter(PyODictObject *od) in odict_iter() argument
1527 return odictiter_new(od, _odict_ITER_KEYS); in odict_iter()
1612 _PyODict_SetItem_KnownHash(PyObject *od, PyObject *key, PyObject *value, in _PyODict_SetItem_KnownHash() argument
1615 int res = _PyDict_SetItem_KnownHash(od, key, value, hash); in _PyODict_SetItem_KnownHash()
1617 res = _odict_add_new_node((PyODictObject *)od, key, hash); in _PyODict_SetItem_KnownHash()
1622 (void) _PyDict_DelItem_KnownHash(od, key, hash); in _PyODict_SetItem_KnownHash()
1630 PyODict_SetItem(PyObject *od, PyObject *key, PyObject *value) in PyODict_SetItem() argument
1635 return _PyODict_SetItem_KnownHash(od, key, value, hash); in PyODict_SetItem()
1639 PyODict_DelItem(PyObject *od, PyObject *key) in PyODict_DelItem() argument
1645 res = _odict_clear_node((PyODictObject *)od, NULL, key, hash); in PyODict_DelItem()
1648 return _PyDict_DelItem_KnownHash(od, key, hash); in PyODict_DelItem()
1862 odictiter_new(PyODictObject *od, int kind) in odictiter_new() argument
1883 node = reversed ? _odict_LAST(od) : _odict_FIRST(od); in odictiter_new()
1886 di->di_size = PyODict_SIZE(od); in odictiter_new()
1887 di->di_state = od->od_state; in odictiter_new()
1888 di->di_odict = od; in odictiter_new()
1889 Py_INCREF(od); in odictiter_new()
1957 odictkeys_new(PyObject *od) in odictkeys_new() argument
1959 return _PyDictView_New(od, &PyODictKeys_Type); in odictkeys_new()
2024 odictitems_new(PyObject *od) in odictitems_new() argument
2026 return _PyDictView_New(od, &PyODictItems_Type); in odictitems_new()
2091 odictvalues_new(PyObject *od) in odictvalues_new() argument
2093 return _PyDictView_New(od, &PyODictValues_Type); in odictvalues_new()