Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
04fd9dd5
Kaydet (Commit)
04fd9dd5
authored
Eyl 08, 2013
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Small rearrangement to bring together the three functions for probing the hash table.
üst
ae7b00e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
32 deletions
+39
-32
setobject.c
Objects/setobject.c
+39
-32
No files found.
Objects/setobject.c
Dosyayı görüntüle @
04fd9dd5
...
...
@@ -64,6 +64,9 @@ PyObject *_PySet_Dummy = dummy;
static
PySetObject
*
free_list
[
PySet_MAXFREELIST
];
static
int
numfree
=
0
;
/* ======================================================================== */
/* ======= Begin logic for probing the hash table ========================= */
static
setentry
*
set_lookkey
(
PySetObject
*
so
,
PyObject
*
key
,
Py_hash_t
hash
)
{
...
...
@@ -197,38 +200,6 @@ set_lookkey_unicode(PySetObject *so, PyObject *key, Py_hash_t hash)
return
freeslot
==
NULL
?
entry
:
freeslot
;
}
/*
Internal routine to insert a new key into the table.
Used by the public insert routine.
Eats a reference to key.
*/
static
int
set_insert_key
(
PySetObject
*
so
,
PyObject
*
key
,
Py_hash_t
hash
)
{
setentry
*
entry
;
assert
(
so
->
lookup
!=
NULL
);
entry
=
so
->
lookup
(
so
,
key
,
hash
);
if
(
entry
==
NULL
)
return
-
1
;
if
(
entry
->
key
==
NULL
)
{
/* UNUSED */
so
->
fill
++
;
entry
->
key
=
key
;
entry
->
hash
=
hash
;
so
->
used
++
;
}
else
if
(
entry
->
key
==
dummy
)
{
/* DUMMY */
entry
->
key
=
key
;
entry
->
hash
=
hash
;
so
->
used
++
;
}
else
{
/* ACTIVE */
Py_DECREF
(
key
);
}
return
0
;
}
/*
Internal routine used by set_table_resize() to insert an item which is
known 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)
so
->
used
++
;
}
/* ======== End logic for probing the hash table ========================== */
/* ======================================================================== */
/*
Internal routine to insert a new key into the table.
Used by the public insert routine.
Eats a reference to key.
*/
static
int
set_insert_key
(
PySetObject
*
so
,
PyObject
*
key
,
Py_hash_t
hash
)
{
setentry
*
entry
;
assert
(
so
->
lookup
!=
NULL
);
entry
=
so
->
lookup
(
so
,
key
,
hash
);
if
(
entry
==
NULL
)
return
-
1
;
if
(
entry
->
key
==
NULL
)
{
/* UNUSED */
so
->
fill
++
;
entry
->
key
=
key
;
entry
->
hash
=
hash
;
so
->
used
++
;
}
else
if
(
entry
->
key
==
dummy
)
{
/* DUMMY */
entry
->
key
=
key
;
entry
->
hash
=
hash
;
so
->
used
++
;
}
else
{
/* ACTIVE */
Py_DECREF
(
key
);
}
return
0
;
}
/*
Restructure the table by allocating a new table and reinserting all
keys again. When entries have been deleted, the new table may
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment