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
d455ce4f
Kaydet (Commit)
d455ce4f
authored
Mar 30, 2014
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
merge 3.3
üst
ff57aefa
0ad6098b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
transmogrify.h
Objects/stringlib/transmogrify.h
+19
-19
No files found.
Objects/stringlib/transmogrify.h
Dosyayı görüntüle @
d455ce4f
...
@@ -15,7 +15,7 @@ stringlib_expandtabs(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -15,7 +15,7 @@ stringlib_expandtabs(PyObject *self, PyObject *args, PyObject *kwds)
{
{
const
char
*
e
,
*
p
;
const
char
*
e
,
*
p
;
char
*
q
;
char
*
q
;
size_t
i
,
j
;
Py_s
size_t
i
,
j
;
PyObject
*
u
;
PyObject
*
u
;
static
char
*
kwlist
[]
=
{
"tabsize"
,
0
};
static
char
*
kwlist
[]
=
{
"tabsize"
,
0
};
int
tabsize
=
8
;
int
tabsize
=
8
;
...
@@ -27,35 +27,31 @@ stringlib_expandtabs(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -27,35 +27,31 @@ stringlib_expandtabs(PyObject *self, PyObject *args, PyObject *kwds)
/* First pass: determine size of output string */
/* First pass: determine size of output string */
i
=
j
=
0
;
i
=
j
=
0
;
e
=
STRINGLIB_STR
(
self
)
+
STRINGLIB_LEN
(
self
);
e
=
STRINGLIB_STR
(
self
)
+
STRINGLIB_LEN
(
self
);
for
(
p
=
STRINGLIB_STR
(
self
);
p
<
e
;
p
++
)
for
(
p
=
STRINGLIB_STR
(
self
);
p
<
e
;
p
++
)
{
if
(
*
p
==
'\t'
)
{
if
(
*
p
==
'\t'
)
{
if
(
tabsize
>
0
)
{
if
(
tabsize
>
0
)
{
j
+=
tabsize
-
(
j
%
tabsize
);
Py_ssize_t
incr
=
tabsize
-
(
j
%
tabsize
);
if
(
j
>
PY_SSIZE_T_MAX
)
{
if
(
j
>
PY_SSIZE_T_MAX
-
incr
)
PyErr_SetString
(
PyExc_OverflowError
,
goto
overflow
;
"result is too long"
);
j
+=
incr
;
return
NULL
;
}
}
}
}
}
else
{
else
{
if
(
j
>
PY_SSIZE_T_MAX
-
1
)
goto
overflow
;
j
++
;
j
++
;
if
(
*
p
==
'\n'
||
*
p
==
'\r'
)
{
if
(
*
p
==
'\n'
||
*
p
==
'\r'
)
{
if
(
i
>
PY_SSIZE_T_MAX
-
j
)
goto
overflow
;
i
+=
j
;
i
+=
j
;
j
=
0
;
j
=
0
;
if
(
i
>
PY_SSIZE_T_MAX
)
{
PyErr_SetString
(
PyExc_OverflowError
,
"result is too long"
);
return
NULL
;
}
}
}
}
}
if
((
i
+
j
)
>
PY_SSIZE_T_MAX
)
{
PyErr_SetString
(
PyExc_OverflowError
,
"result is too long"
);
return
NULL
;
}
}
if
(
i
>
PY_SSIZE_T_MAX
-
j
)
goto
overflow
;
/* Second pass: create output string and fill it */
/* Second pass: create output string and fill it */
u
=
STRINGLIB_NEW
(
NULL
,
i
+
j
);
u
=
STRINGLIB_NEW
(
NULL
,
i
+
j
);
if
(
!
u
)
if
(
!
u
)
...
@@ -63,8 +59,8 @@ stringlib_expandtabs(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -63,8 +59,8 @@ stringlib_expandtabs(PyObject *self, PyObject *args, PyObject *kwds)
j
=
0
;
j
=
0
;
q
=
STRINGLIB_STR
(
u
);
q
=
STRINGLIB_STR
(
u
);
for
(
p
=
STRINGLIB_STR
(
self
);
p
<
e
;
p
++
)
for
(
p
=
STRINGLIB_STR
(
self
);
p
<
e
;
p
++
)
{
if
(
*
p
==
'\t'
)
{
if
(
*
p
==
'\t'
)
{
if
(
tabsize
>
0
)
{
if
(
tabsize
>
0
)
{
i
=
tabsize
-
(
j
%
tabsize
);
i
=
tabsize
-
(
j
%
tabsize
);
...
@@ -79,8 +75,12 @@ stringlib_expandtabs(PyObject *self, PyObject *args, PyObject *kwds)
...
@@ -79,8 +75,12 @@ stringlib_expandtabs(PyObject *self, PyObject *args, PyObject *kwds)
if
(
*
p
==
'\n'
||
*
p
==
'\r'
)
if
(
*
p
==
'\n'
||
*
p
==
'\r'
)
j
=
0
;
j
=
0
;
}
}
}
return
u
;
return
u
;
overflow:
PyErr_SetString
(
PyExc_OverflowError
,
"result too long"
);
return
NULL
;
}
}
Py_LOCAL_INLINE
(
PyObject
*
)
Py_LOCAL_INLINE
(
PyObject
*
)
...
...
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