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
554da412
Kaydet (Commit)
554da412
authored
May 25, 2006
tarafından
Fredrik Lundh
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
needforspeed: use insert+reverse instead of append
üst
684fd0c8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
16 deletions
+8
-16
stringobject.c
Objects/stringobject.c
+8
-16
No files found.
Objects/stringobject.c
Dosyayı görüntüle @
554da412
...
@@ -1461,18 +1461,6 @@ static const char *stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"};
...
@@ -1461,18 +1461,6 @@ static const char *stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"};
else \
else \
Py_DECREF(str);
Py_DECREF(str);
#define SPLIT_INSERT(data, left, right) \
str = PyString_FromStringAndSize((data) + (left), \
(right) - (left)); \
if (str == NULL) \
goto onError; \
if (PyList_Insert(list, 0, str)) { \
Py_DECREF(str); \
goto onError; \
} \
else \
Py_DECREF(str);
static
PyObject
*
static
PyObject
*
split_whitespace
(
const
char
*
s
,
Py_ssize_t
len
,
Py_ssize_t
maxsplit
)
split_whitespace
(
const
char
*
s
,
Py_ssize_t
len
,
Py_ssize_t
maxsplit
)
{
{
...
@@ -1632,15 +1620,17 @@ rsplit_whitespace(const char *s, Py_ssize_t len, Py_ssize_t maxsplit)
...
@@ -1632,15 +1620,17 @@ rsplit_whitespace(const char *s, Py_ssize_t len, Py_ssize_t maxsplit)
if
(
j
>
i
)
{
if
(
j
>
i
)
{
if
(
maxsplit
--
<=
0
)
if
(
maxsplit
--
<=
0
)
break
;
break
;
SPLIT_
INSERT
(
s
,
i
+
1
,
j
+
1
);
SPLIT_
APPEND
(
s
,
i
+
1
,
j
+
1
);
while
(
i
>=
0
&&
isspace
(
Py_CHARMASK
(
s
[
i
])))
while
(
i
>=
0
&&
isspace
(
Py_CHARMASK
(
s
[
i
])))
i
--
;
i
--
;
j
=
i
;
j
=
i
;
}
}
}
}
if
(
j
>=
0
)
{
if
(
j
>=
0
)
{
SPLIT_
INSERT
(
s
,
0
,
j
+
1
);
SPLIT_
APPEND
(
s
,
0
,
j
+
1
);
}
}
if
(
PyList_Reverse
(
list
)
<
0
)
goto
onError
;
return
list
;
return
list
;
onError:
onError:
Py_DECREF
(
list
);
Py_DECREF
(
list
);
...
@@ -1661,14 +1651,16 @@ rsplit_char(const char *s, Py_ssize_t len, char ch, Py_ssize_t maxcount)
...
@@ -1661,14 +1651,16 @@ rsplit_char(const char *s, Py_ssize_t len, char ch, Py_ssize_t maxcount)
if
(
s
[
i
]
==
ch
)
{
if
(
s
[
i
]
==
ch
)
{
if
(
maxcount
--
<=
0
)
if
(
maxcount
--
<=
0
)
break
;
break
;
SPLIT_
INSERT
(
s
,
i
+
1
,
j
+
1
);
SPLIT_
APPEND
(
s
,
i
+
1
,
j
+
1
);
j
=
i
=
i
-
1
;
j
=
i
=
i
-
1
;
}
else
}
else
i
--
;
i
--
;
}
}
if
(
j
>=
-
1
)
{
if
(
j
>=
-
1
)
{
SPLIT_
INSERT
(
s
,
0
,
j
+
1
);
SPLIT_
APPEND
(
s
,
0
,
j
+
1
);
}
}
if
(
PyList_Reverse
(
list
)
<
0
)
goto
onError
;
return
list
;
return
list
;
onError:
onError:
...
...
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