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
b48d6a63
Kaydet (Commit)
b48d6a63
authored
Tem 05, 2015
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Bring related functions add/contains/discard together in the code.
üst
73799b18
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
40 deletions
+34
-40
setobject.c
Objects/setobject.c
+34
-40
No files found.
Objects/setobject.c
Dosyayı görüntüle @
b48d6a63
...
...
@@ -366,17 +366,14 @@ set_table_resize(PySetObject *so, Py_ssize_t minused)
}
static
int
set_
add_key
(
PySetObject
*
so
,
PyObject
*
key
)
set_
contains_entry
(
PySetObject
*
so
,
PyObject
*
key
,
Py_hash_t
hash
)
{
Py_hash_t
hash
;
setentry
*
entry
;
if
(
!
PyUnicode_CheckExact
(
key
)
||
(
hash
=
((
PyASCIIObject
*
)
key
)
->
hash
)
==
-
1
)
{
hash
=
PyObject_Hash
(
key
);
if
(
hash
==
-
1
)
return
-
1
;
}
return
set_add_entry
(
so
,
key
,
hash
);
entry
=
set_lookkey
(
so
,
key
,
hash
);
if
(
entry
!=
NULL
)
return
entry
->
key
!=
NULL
;
return
-
1
;
}
#define DISCARD_NOTFOUND 0
...
...
@@ -402,11 +399,37 @@ set_discard_entry(PySetObject *so, PyObject *key, Py_hash_t hash)
}
static
int
set_
discar
d_key
(
PySetObject
*
so
,
PyObject
*
key
)
set_
ad
d_key
(
PySetObject
*
so
,
PyObject
*
key
)
{
Py_hash_t
hash
;
assert
(
PyAnySet_Check
(
so
));
if
(
!
PyUnicode_CheckExact
(
key
)
||
(
hash
=
((
PyASCIIObject
*
)
key
)
->
hash
)
==
-
1
)
{
hash
=
PyObject_Hash
(
key
);
if
(
hash
==
-
1
)
return
-
1
;
}
return
set_add_entry
(
so
,
key
,
hash
);
}
static
int
set_contains_key
(
PySetObject
*
so
,
PyObject
*
key
)
{
Py_hash_t
hash
;
if
(
!
PyUnicode_CheckExact
(
key
)
||
(
hash
=
((
PyASCIIObject
*
)
key
)
->
hash
)
==
-
1
)
{
hash
=
PyObject_Hash
(
key
);
if
(
hash
==
-
1
)
return
-
1
;
}
return
set_contains_entry
(
so
,
key
,
hash
);
}
static
int
set_discard_key
(
PySetObject
*
so
,
PyObject
*
key
)
{
Py_hash_t
hash
;
if
(
!
PyUnicode_CheckExact
(
key
)
||
(
hash
=
((
PyASCIIObject
*
)
key
)
->
hash
)
==
-
1
)
{
...
...
@@ -653,35 +676,6 @@ set_merge(PySetObject *so, PyObject *otherset)
return
0
;
}
static
int
set_contains_entry
(
PySetObject
*
so
,
PyObject
*
key
,
Py_hash_t
hash
)
{
setentry
*
lu_entry
;
lu_entry
=
set_lookkey
(
so
,
key
,
hash
);
if
(
lu_entry
!=
NULL
)
return
lu_entry
->
key
!=
NULL
;
return
-
1
;
}
static
int
set_contains_key
(
PySetObject
*
so
,
PyObject
*
key
)
{
setentry
*
entry
;
Py_hash_t
hash
;
if
(
!
PyUnicode_CheckExact
(
key
)
||
(
hash
=
((
PyASCIIObject
*
)
key
)
->
hash
)
==
-
1
)
{
hash
=
PyObject_Hash
(
key
);
if
(
hash
==
-
1
)
return
-
1
;
}
entry
=
set_lookkey
(
so
,
key
,
hash
);
if
(
entry
==
NULL
)
return
-
1
;
return
entry
->
key
!=
NULL
;
}
static
PyObject
*
set_pop
(
PySetObject
*
so
)
{
...
...
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