@@ -64,6 +64,9 @@ PyObject *_PySet_Dummy = dummy;
6464static PySetObject * free_list [PySet_MAXFREELIST ];
6565static int numfree = 0 ;
6666
67+ /* ======================================================================== */
68+ /* ======= Begin logic for probing the hash table ========================= */
69+
6770static setentry *
6871set_lookkey (PySetObject * so , PyObject * key , Py_hash_t hash )
6972{
@@ -197,38 +200,6 @@ set_lookkey_unicode(PySetObject *so, PyObject *key, Py_hash_t hash)
197200 return freeslot == NULL ? entry : freeslot ;
198201}
199202
200- /*
201- Internal routine to insert a new key into the table.
202- Used by the public insert routine.
203- Eats a reference to key.
204- */
205- static int
206- set_insert_key (PySetObject * so , PyObject * key , Py_hash_t hash )
207- {
208- setentry * entry ;
209-
210- assert (so -> lookup != NULL );
211- entry = so -> lookup (so , key , hash );
212- if (entry == NULL )
213- return -1 ;
214- if (entry -> key == NULL ) {
215- /* UNUSED */
216- so -> fill ++ ;
217- entry -> key = key ;
218- entry -> hash = hash ;
219- so -> used ++ ;
220- } else if (entry -> key == dummy ) {
221- /* DUMMY */
222- entry -> key = key ;
223- entry -> hash = hash ;
224- so -> used ++ ;
225- } else {
226- /* ACTIVE */
227- Py_DECREF (key );
228- }
229- return 0 ;
230- }
231-
232203/*
233204Internal routine used by set_table_resize() to insert an item which is
234205known to be absent from the set. This routine also assumes that
@@ -266,6 +237,42 @@ set_insert_clean(PySetObject *so, PyObject *key, Py_hash_t hash)
266237 so -> used ++ ;
267238}
268239
240+ /* ======== End logic for probing the hash table ========================== */
241+ /* ======================================================================== */
242+
243+
244+ /*
245+ Internal routine to insert a new key into the table.
246+ Used by the public insert routine.
247+ Eats a reference to key.
248+ */
249+ static int
250+ set_insert_key (PySetObject * so , PyObject * key , Py_hash_t hash )
251+ {
252+ setentry * entry ;
253+
254+ assert (so -> lookup != NULL );
255+ entry = so -> lookup (so , key , hash );
256+ if (entry == NULL )
257+ return -1 ;
258+ if (entry -> key == NULL ) {
259+ /* UNUSED */
260+ so -> fill ++ ;
261+ entry -> key = key ;
262+ entry -> hash = hash ;
263+ so -> used ++ ;
264+ } else if (entry -> key == dummy ) {
265+ /* DUMMY */
266+ entry -> key = key ;
267+ entry -> hash = hash ;
268+ so -> used ++ ;
269+ } else {
270+ /* ACTIVE */
271+ Py_DECREF (key );
272+ }
273+ return 0 ;
274+ }
275+
269276/*
270277Restructure the table by allocating a new table and reinserting all
271278keys again. When entries have been deleted, the new table may
0 commit comments