Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
fc7b6887
Commit
fc7b6887
authored
Feb 26, 2011
by
Alexander Belopolsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PEP 7 conformance changes (whitespace only).
parent
2886808d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
350 additions
and
284 deletions
+350
-284
Objects/unicodeobject.c
Objects/unicodeobject.c
+350
-284
No files found.
Objects/unicodeobject.c
View file @
fc7b6887
...
...
@@ -142,12 +142,14 @@ const unsigned char _Py_ascii_whitespace[] = {
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
static
PyObject
*
unicode_encode_call_errorhandler
(
const
char
*
errors
,
static
PyObject
*
unicode_encode_call_errorhandler
(
const
char
*
errors
,
PyObject
**
errorHandler
,
const
char
*
encoding
,
const
char
*
reason
,
const
Py_UNICODE
*
unicode
,
Py_ssize_t
size
,
PyObject
**
exceptionObject
,
Py_ssize_t
startpos
,
Py_ssize_t
endpos
,
Py_ssize_t
*
newpos
);
static
void
raise_encode_exception
(
PyObject
**
exceptionObject
,
static
void
raise_encode_exception
(
PyObject
**
exceptionObject
,
const
char
*
encoding
,
const
Py_UNICODE
*
unicode
,
Py_ssize_t
size
,
Py_ssize_t
startpos
,
Py_ssize_t
endpos
,
...
...
@@ -223,7 +225,8 @@ static BLOOM_MASK bloom_linebreak;
((ch) < 128U ? ascii_linebreak[(ch)] : \
(BLOOM(bloom_linebreak, (ch)) && Py_UNICODE_ISLINEBREAK(ch)))
Py_LOCAL_INLINE
(
BLOOM_MASK
)
make_bloom_mask
(
Py_UNICODE
*
ptr
,
Py_ssize_t
len
)
Py_LOCAL_INLINE
(
BLOOM_MASK
)
make_bloom_mask
(
Py_UNICODE
*
ptr
,
Py_ssize_t
len
)
{
/* calculate simple bloom-style bitmask for a given unicode string */
...
...
@@ -237,7 +240,8 @@ Py_LOCAL_INLINE(BLOOM_MASK) make_bloom_mask(Py_UNICODE* ptr, Py_ssize_t len)
return
mask
;
}
Py_LOCAL_INLINE
(
int
)
unicode_member
(
Py_UNICODE
chr
,
Py_UNICODE
*
set
,
Py_ssize_t
setlen
)
Py_LOCAL_INLINE
(
int
)
unicode_member
(
Py_UNICODE
chr
,
Py_UNICODE
*
set
,
Py_ssize_t
setlen
)
{
Py_ssize_t
i
;
...
...
@@ -253,8 +257,8 @@ Py_LOCAL_INLINE(int) unicode_member(Py_UNICODE chr, Py_UNICODE* set, Py_ssize_t
/* --- Unicode Object ----------------------------------------------------- */
static
int
unicode_resize
(
register
PyUnicodeObject
*
unicode
,
static
int
unicode_resize
(
register
PyUnicodeObject
*
unicode
,
Py_ssize_t
length
)
{
void
*
oldstr
;
...
...
@@ -311,8 +315,8 @@ int unicode_resize(register PyUnicodeObject *unicode,
*/
static
PyUnicodeObject
*
_PyUnicode_New
(
Py_ssize_t
length
)
static
PyUnicodeObject
*
_PyUnicode_New
(
Py_ssize_t
length
)
{
register
PyUnicodeObject
*
unicode
;
...
...
@@ -383,8 +387,8 @@ PyUnicodeObject *_PyUnicode_New(Py_ssize_t length)
return
NULL
;
}
static
void
unicode_dealloc
(
register
PyUnicodeObject
*
unicode
)
static
void
unicode_dealloc
(
register
PyUnicodeObject
*
unicode
)
{
switch
(
PyUnicode_CHECK_INTERNED
(
unicode
))
{
case
SSTATE_NOT_INTERNED
:
...
...
@@ -428,8 +432,8 @@ void unicode_dealloc(register PyUnicodeObject *unicode)
}
}
static
int
_PyUnicode_Resize
(
PyUnicodeObject
**
unicode
,
Py_ssize_t
length
)
static
int
_PyUnicode_Resize
(
PyUnicodeObject
**
unicode
,
Py_ssize_t
length
)
{
register
PyUnicodeObject
*
v
;
...
...
@@ -464,13 +468,14 @@ int _PyUnicode_Resize(PyUnicodeObject **unicode, Py_ssize_t length)
return
unicode_resize
(
v
,
length
);
}
int
PyUnicode_Resize
(
PyObject
**
unicode
,
Py_ssize_t
length
)
int
PyUnicode_Resize
(
PyObject
**
unicode
,
Py_ssize_t
length
)
{
return
_PyUnicode_Resize
((
PyUnicodeObject
**
)
unicode
,
length
);
}
PyObject
*
PyUnicode_FromUnicode
(
const
Py_UNICODE
*
u
,
Py_ssize_t
size
)
PyObject
*
PyUnicode_FromUnicode
(
const
Py_UNICODE
*
u
,
Py_ssize_t
size
)
{
PyUnicodeObject
*
unicode
;
...
...
@@ -511,7 +516,8 @@ PyObject *PyUnicode_FromUnicode(const Py_UNICODE *u,
return
(
PyObject
*
)
unicode
;
}
PyObject
*
PyUnicode_FromStringAndSize
(
const
char
*
u
,
Py_ssize_t
size
)
PyObject
*
PyUnicode_FromStringAndSize
(
const
char
*
u
,
Py_ssize_t
size
)
{
PyUnicodeObject
*
unicode
;
...
...
@@ -558,7 +564,8 @@ PyObject *PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size)
return
(
PyObject
*
)
unicode
;
}
PyObject
*
PyUnicode_FromString
(
const
char
*
u
)
PyObject
*
PyUnicode_FromString
(
const
char
*
u
)
{
size_t
size
=
strlen
(
u
);
if
(
size
>
PY_SSIZE_T_MAX
)
{
...
...
@@ -580,8 +587,8 @@ PyObject *PyUnicode_FromString(const char *u)
/* Here sizeof(wchar_t) is 4 but Py_UNICODE_SIZE == 2, so we need
to convert from UTF32 to UTF16. */
PyObject
*
PyUnicode_FromWideChar
(
register
const
wchar_t
*
w
,
Py_ssize_t
size
)
PyObject
*
PyUnicode_FromWideChar
(
register
const
wchar_t
*
w
,
Py_ssize_t
size
)
{
PyUnicodeObject
*
unicode
;
register
Py_ssize_t
i
;
...
...
@@ -631,8 +638,8 @@ PyObject *PyUnicode_FromWideChar(register const wchar_t *w,
#else
PyObject
*
PyUnicode_FromWideChar
(
register
const
wchar_t
*
w
,
Py_ssize_t
size
)
PyObject
*
PyUnicode_FromWideChar
(
register
const
wchar_t
*
w
,
Py_ssize_t
size
)
{
PyUnicodeObject
*
unicode
;
...
...
@@ -1324,7 +1331,8 @@ PyUnicode_AsWideCharString(PyObject *unicode,
#endif
PyObject
*
PyUnicode_FromOrdinal
(
int
ordinal
)
PyObject
*
PyUnicode_FromOrdinal
(
int
ordinal
)
{
Py_UNICODE
s
[
2
];
...
...
@@ -1347,7 +1355,8 @@ PyObject *PyUnicode_FromOrdinal(int ordinal)
return
PyUnicode_FromUnicode
(
s
,
1
);
}
PyObject
*
PyUnicode_FromObject
(
register
PyObject
*
obj
)
PyObject
*
PyUnicode_FromObject
(
register
PyObject
*
obj
)
{
/* XXX Perhaps we should make this API an alias of
PyObject_Str() instead ?! */
...
...
@@ -1367,7 +1376,8 @@ PyObject *PyUnicode_FromObject(register PyObject *obj)
return
NULL
;
}
PyObject
*
PyUnicode_FromEncodedObject
(
register
PyObject
*
obj
,
PyObject
*
PyUnicode_FromEncodedObject
(
register
PyObject
*
obj
,
const
char
*
encoding
,
const
char
*
errors
)
{
...
...
@@ -1452,7 +1462,8 @@ normalize_encoding(const char *encoding,
return
1
;
}
PyObject
*
PyUnicode_Decode
(
const
char
*
s
,
PyObject
*
PyUnicode_Decode
(
const
char
*
s
,
Py_ssize_t
size
,
const
char
*
encoding
,
const
char
*
errors
)
...
...
@@ -1510,7 +1521,8 @@ PyObject *PyUnicode_Decode(const char *s,
return
NULL
;
}
PyObject
*
PyUnicode_AsDecodedObject
(
PyObject
*
unicode
,
PyObject
*
PyUnicode_AsDecodedObject
(
PyObject
*
unicode
,
const
char
*
encoding
,
const
char
*
errors
)
{
...
...
@@ -1534,7 +1546,8 @@ PyObject *PyUnicode_AsDecodedObject(PyObject *unicode,
return
NULL
;
}
PyObject
*
PyUnicode_AsDecodedUnicode
(
PyObject
*
unicode
,
PyObject
*
PyUnicode_AsDecodedUnicode
(
PyObject
*
unicode
,
const
char
*
encoding
,
const
char
*
errors
)
{
...
...
@@ -1565,7 +1578,8 @@ PyObject *PyUnicode_AsDecodedUnicode(PyObject *unicode,
return
NULL
;
}
PyObject
*
PyUnicode_Encode
(
const
Py_UNICODE
*
s
,
PyObject
*
PyUnicode_Encode
(
const
Py_UNICODE
*
s
,
Py_ssize_t
size
,
const
char
*
encoding
,
const
char
*
errors
)
...
...
@@ -1580,7 +1594,8 @@ PyObject *PyUnicode_Encode(const Py_UNICODE *s,
return
v
;
}
PyObject
*
PyUnicode_AsEncodedObject
(
PyObject
*
unicode
,
PyObject
*
PyUnicode_AsEncodedObject
(
PyObject
*
unicode
,
const
char
*
encoding
,
const
char
*
errors
)
{
...
...
@@ -1659,7 +1674,8 @@ PyUnicode_EncodeFSDefault(PyObject *unicode)
#endif
}
PyObject
*
PyUnicode_AsEncodedString
(
PyObject
*
unicode
,
PyObject
*
PyUnicode_AsEncodedString
(
PyObject
*
unicode
,
const
char
*
encoding
,
const
char
*
errors
)
{
...
...
@@ -1735,7 +1751,8 @@ PyObject *PyUnicode_AsEncodedString(PyObject *unicode,
return
NULL
;
}
PyObject
*
PyUnicode_AsEncodedUnicode
(
PyObject
*
unicode
,
PyObject
*
PyUnicode_AsEncodedUnicode
(
PyObject
*
unicode
,
const
char
*
encoding
,
const
char
*
errors
)
{
...
...
@@ -1766,7 +1783,8 @@ PyObject *PyUnicode_AsEncodedUnicode(PyObject *unicode,
return
NULL
;
}
PyObject
*
_PyUnicode_AsDefaultEncodedString
(
PyObject
*
unicode
,
PyObject
*
_PyUnicode_AsDefaultEncodedString
(
PyObject
*
unicode
,
const
char
*
errors
)
{
PyObject
*
v
=
((
PyUnicodeObject
*
)
unicode
)
->
defenc
;
...
...
@@ -1933,7 +1951,8 @@ _PyUnicode_AsString(PyObject *unicode)
return
_PyUnicode_AsStringAndSize
(
unicode
,
NULL
);
}
Py_UNICODE
*
PyUnicode_AsUnicode
(
PyObject
*
unicode
)
Py_UNICODE
*
PyUnicode_AsUnicode
(
PyObject
*
unicode
)
{
if
(
!
PyUnicode_Check
(
unicode
))
{
PyErr_BadArgument
();
...
...
@@ -1945,7 +1964,8 @@ Py_UNICODE *PyUnicode_AsUnicode(PyObject *unicode)
return
NULL
;
}
Py_ssize_t
PyUnicode_GetSize
(
PyObject
*
unicode
)
Py_ssize_t
PyUnicode_GetSize
(
PyObject
*
unicode
)
{
if
(
!
PyUnicode_Check
(
unicode
))
{
PyErr_BadArgument
();
...
...
@@ -1957,7 +1977,8 @@ Py_ssize_t PyUnicode_GetSize(PyObject *unicode)
return
-
1
;
}
const
char
*
PyUnicode_GetDefaultEncoding
(
void
)
const
char
*
PyUnicode_GetDefaultEncoding
(
void
)
{
return
"utf-8"
;
}
...
...
@@ -1996,8 +2017,8 @@ onError:
return 0 on success, -1 on error
*/
static
int
unicode_decode_call_errorhandler
(
const
char
*
errors
,
PyObject
**
errorHandler
,
static
int
unicode_decode_call_errorhandler
(
const
char
*
errors
,
PyObject
**
errorHandler
,
const
char
*
encoding
,
const
char
*
reason
,
const
char
**
input
,
const
char
**
inend
,
Py_ssize_t
*
startinpos
,
Py_ssize_t
*
endinpos
,
PyObject
**
exceptionObject
,
const
char
**
inptr
,
...
...
@@ -2171,7 +2192,8 @@ char utf7_category[128] = {
(directWS && (utf7_category[(c)] == 2)) || \
(directO && (utf7_category[(c)] == 1))))
PyObject
*
PyUnicode_DecodeUTF7
(
const
char
*
s
,
PyObject
*
PyUnicode_DecodeUTF7
(
const
char
*
s
,
Py_ssize_t
size
,
const
char
*
errors
)
{
...
...
@@ -2185,7 +2207,8 @@ PyObject *PyUnicode_DecodeUTF7(const char *s,
* all the shift state (seen bits, number of bits seen, high
* surrogate). */
PyObject
*
PyUnicode_DecodeUTF7Stateful
(
const
char
*
s
,
PyObject
*
PyUnicode_DecodeUTF7Stateful
(
const
char
*
s
,
Py_ssize_t
size
,
const
char
*
errors
,
Py_ssize_t
*
consumed
)
...
...
@@ -2375,7 +2398,8 @@ utf7Error:
}
PyObject
*
PyUnicode_EncodeUTF7
(
const
Py_UNICODE
*
s
,
PyObject
*
PyUnicode_EncodeUTF7
(
const
Py_UNICODE
*
s
,
Py_ssize_t
size
,
int
base64SetO
,
int
base64WhiteSpace
,
...
...
@@ -2500,7 +2524,8 @@ char utf8_code_length[256] = {
4
,
4
,
4
,
4
,
4
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
/* F0-F4 + F5-FF */
};
PyObject
*
PyUnicode_DecodeUTF8
(
const
char
*
s
,
PyObject
*
PyUnicode_DecodeUTF8
(
const
char
*
s
,
Py_ssize_t
size
,
const
char
*
errors
)
{
...
...
@@ -2520,7 +2545,8 @@ PyObject *PyUnicode_DecodeUTF8(const char *s,
# error C 'long' size should be either 4 or 8!
#endif
PyObject
*
PyUnicode_DecodeUTF8Stateful
(
const
char
*
s
,
PyObject
*
PyUnicode_DecodeUTF8Stateful
(
const
char
*
s
,
Py_ssize_t
size
,
const
char
*
errors
,
Py_ssize_t
*
consumed
)
...
...
@@ -3029,7 +3055,8 @@ PyUnicode_EncodeUTF8(const Py_UNICODE *s,
#undef MAX_SHORT_UNICHARS
}
PyObject
*
PyUnicode_AsUTF8String
(
PyObject
*
unicode
)
PyObject
*
PyUnicode_AsUTF8String
(
PyObject
*
unicode
)
{
if
(
!
PyUnicode_Check
(
unicode
))
{
PyErr_BadArgument
();
...
...
@@ -3303,7 +3330,8 @@ PyUnicode_EncodeUTF32(const Py_UNICODE *s,
#undef STORECHAR
}
PyObject
*
PyUnicode_AsUTF32String
(
PyObject
*
unicode
)
PyObject
*
PyUnicode_AsUTF32String
(
PyObject
*
unicode
)
{
if
(
!
PyUnicode_Check
(
unicode
))
{
PyErr_BadArgument
();
...
...
@@ -3693,7 +3721,8 @@ PyUnicode_EncodeUTF16(const Py_UNICODE *s,
#undef STORECHAR
}
PyObject
*
PyUnicode_AsUTF16String
(
PyObject
*
unicode
)
PyObject
*
PyUnicode_AsUTF16String
(
PyObject
*
unicode
)
{
if
(
!
PyUnicode_Check
(
unicode
))
{
PyErr_BadArgument
();
...
...
@@ -3709,7 +3738,8 @@ PyObject *PyUnicode_AsUTF16String(PyObject *unicode)
static
_PyUnicode_Name_CAPI
*
ucnhash_CAPI
=
NULL
;
PyObject
*
PyUnicode_DecodeUnicodeEscape
(
const
char
*
s
,
PyObject
*
PyUnicode_DecodeUnicodeEscape
(
const
char
*
s
,
Py_ssize_t
size
,
const
char
*
errors
)
{
...
...
@@ -3967,7 +3997,8 @@ Py_LOCAL_INLINE(const Py_UNICODE *) findchar(const Py_UNICODE *s,
static
const
char
*
hexdigits
=
"0123456789abcdef"
;
PyObject
*
PyUnicode_EncodeUnicodeEscape
(
const
Py_UNICODE
*
s
,
PyObject
*
PyUnicode_EncodeUnicodeEscape
(
const
Py_UNICODE
*
s
,
Py_ssize_t
size
)
{
PyObject
*
repr
;
...
...
@@ -4108,7 +4139,8 @@ PyObject *PyUnicode_EncodeUnicodeEscape(const Py_UNICODE *s,
return
repr
;
}
PyObject
*
PyUnicode_AsUnicodeEscapeString
(
PyObject
*
unicode
)
PyObject
*
PyUnicode_AsUnicodeEscapeString
(
PyObject
*
unicode
)
{
PyObject
*
s
;
if
(
!
PyUnicode_Check
(
unicode
))
{
...
...
@@ -4122,7 +4154,8 @@ PyObject *PyUnicode_AsUnicodeEscapeString(PyObject *unicode)
/* --- Raw Unicode Escape Codec ------------------------------------------- */
PyObject
*
PyUnicode_DecodeRawUnicodeEscape
(
const
char
*
s
,
PyObject
*
PyUnicode_DecodeRawUnicodeEscape
(
const
char
*
s
,
Py_ssize_t
size
,
const
char
*
errors
)
{
...
...
@@ -4239,7 +4272,8 @@ PyObject *PyUnicode_DecodeRawUnicodeEscape(const char *s,
return
NULL
;
}
PyObject
*
PyUnicode_EncodeRawUnicodeEscape
(
const
Py_UNICODE
*
s
,
PyObject
*
PyUnicode_EncodeRawUnicodeEscape
(
const
Py_UNICODE
*
s
,
Py_ssize_t
size
)
{
PyObject
*
repr
;
...
...
@@ -4327,7 +4361,8 @@ PyObject *PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s,
return
repr
;
}
PyObject
*
PyUnicode_AsRawUnicodeEscapeString
(
PyObject
*
unicode
)
PyObject
*
PyUnicode_AsRawUnicodeEscapeString
(
PyObject
*
unicode
)
{
PyObject
*
s
;
if
(
!
PyUnicode_Check
(
unicode
))
{
...
...
@@ -4342,7 +4377,8 @@ PyObject *PyUnicode_AsRawUnicodeEscapeString(PyObject *unicode)
/* --- Unicode Internal Codec ------------------------------------------- */
PyObject
*
_PyUnicode_DecodeUnicodeInternal
(
const
char
*
s
,
PyObject
*
_PyUnicode_DecodeUnicodeInternal
(
const
char
*
s
,
Py_ssize_t
size
,
const
char
*
errors
)
{
...
...
@@ -4420,7 +4456,8 @@ PyObject *_PyUnicode_DecodeUnicodeInternal(const char *s,
/* --- Latin-1 Codec ------------------------------------------------------ */
PyObject
*
PyUnicode_DecodeLatin1
(
const
char
*
s
,
PyObject
*
PyUnicode_DecodeLatin1
(
const
char
*
s
,
Py_ssize_t
size
,
const
char
*
errors
)
{
...
...
@@ -4462,7 +4499,8 @@ PyObject *PyUnicode_DecodeLatin1(const char *s,
}
/* create or adjust a UnicodeEncodeError */
static
void
make_encode_exception
(
PyObject
**
exceptionObject
,
static
void
make_encode_exception
(
PyObject
**
exceptionObject
,
const
char
*
encoding
,
const
Py_UNICODE
*
unicode
,
Py_ssize_t
size
,
Py_ssize_t
startpos
,
Py_ssize_t
endpos
,
...
...
@@ -4487,7 +4525,8 @@ static void make_encode_exception(PyObject **exceptionObject,
}
/* raises a UnicodeEncodeError */
static
void
raise_encode_exception
(
PyObject
**
exceptionObject
,
static
void
raise_encode_exception
(
PyObject
**
exceptionObject
,
const
char
*
encoding
,
const
Py_UNICODE
*
unicode
,
Py_ssize_t
size
,
Py_ssize_t
startpos
,
Py_ssize_t
endpos
,
...
...
@@ -4503,7 +4542,8 @@ static void raise_encode_exception(PyObject **exceptionObject,
build arguments, call the callback and check the arguments,
put the result into newpos and return the replacement string, which
has to be freed by the caller */
static
PyObject
*
unicode_encode_call_errorhandler
(
const
char
*
errors
,
static
PyObject
*
unicode_encode_call_errorhandler
(
const
char
*
errors
,
PyObject
**
errorHandler
,
const
char
*
encoding
,
const
char
*
reason
,
const
Py_UNICODE
*
unicode
,
Py_ssize_t
size
,
PyObject
**
exceptionObject
,
...
...
@@ -4557,7 +4597,8 @@ static PyObject *unicode_encode_call_errorhandler(const char *errors,
return
resunicode
;
}
static
PyObject
*
unicode_encode_ucs1
(
const
Py_UNICODE
*
p
,
static
PyObject
*
unicode_encode_ucs1
(
const
Py_UNICODE
*
p
,
Py_ssize_t
size
,
const
char
*
errors
,
int
limit
)
...
...
@@ -4753,14 +4794,16 @@ static PyObject *unicode_encode_ucs1(const Py_UNICODE *p,
return
NULL
;
}
PyObject
*
PyUnicode_EncodeLatin1
(
const
Py_UNICODE
*
p
,
PyObject
*
PyUnicode_EncodeLatin1
(
const
Py_UNICODE
*
p
,
Py_ssize_t
size
,
const
char
*
errors
)
{
return
unicode_encode_ucs1
(
p
,
size
,
errors
,
256
);
}
PyObject
*
PyUnicode_AsLatin1String
(
PyObject
*
unicode
)
PyObject
*
PyUnicode_AsLatin1String
(
PyObject
*
unicode
)
{
if
(
!
PyUnicode_Check
(
unicode
))
{
PyErr_BadArgument
();
...
...
@@ -4773,7 +4816,8 @@ PyObject *PyUnicode_AsLatin1String(PyObject *unicode)
/* --- 7-bit ASCII Codec -------------------------------------------------- */
PyObject
*
PyUnicode_DecodeASCII
(
const
char
*
s
,
PyObject
*
PyUnicode_DecodeASCII
(
const
char
*
s
,
Py_ssize_t
size
,
const
char
*
errors
)
{
...
...
@@ -4832,14 +4876,16 @@ PyObject *PyUnicode_DecodeASCII(const char *s,
return
NULL
;
}
PyObject
*
PyUnicode_EncodeASCII
(
const
Py_UNICODE
*
p
,
PyObject
*
PyUnicode_EncodeASCII
(
const
Py_UNICODE
*
p
,
Py_ssize_t
size
,
const
char
*
errors
)
{
return
unicode_encode_ucs1
(
p
,
size
,
errors
,
128
);
}
PyObject
*
PyUnicode_AsASCIIString
(
PyObject
*
unicode
)
PyObject
*
PyUnicode_AsASCIIString
(
PyObject
*
unicode
)
{
if
(
!
PyUnicode_Check
(
unicode
))
{
PyErr_BadArgument
();
...
...
@@ -4863,7 +4909,8 @@ PyObject *PyUnicode_AsASCIIString(PyObject *unicode)
b) IsDBCSLeadByte (probably) does not work for non-DBCS multi-byte
encodings, see IsDBCSLeadByteEx documentation. */
static
int
is_dbcs_lead_byte
(
const
char
*
s
,
int
offset
)
static
int
is_dbcs_lead_byte
(
const
char
*
s
,
int
offset
)
{
const
char
*
curr
=
s
+
offset
;
...
...
@@ -4878,7 +4925,8 @@ static int is_dbcs_lead_byte(const char *s, int offset)
* Decode MBCS string into unicode object. If 'final' is set, converts
* trailing lead-byte too. Returns consumed size if succeed, -1 otherwise.
*/
static
int
decode_mbcs
(
PyUnicodeObject
**
v
,
static
int
decode_mbcs
(
PyUnicodeObject
**
v
,
const
char
*
s
,
/* MBCS string */
int
size
,
/* sizeof MBCS string */
int
final
,
...
...
@@ -4961,7 +5009,8 @@ mbcs_decode_error:
return
-
1
;
}
PyObject
*
PyUnicode_DecodeMBCSStateful
(
const
char
*
s
,
PyObject
*
PyUnicode_DecodeMBCSStateful
(
const
char
*
s
,
Py_ssize_t
size
,
const
char
*
errors
,
Py_ssize_t
*
consumed
)
...
...
@@ -4999,7 +5048,8 @@ PyObject *PyUnicode_DecodeMBCSStateful(const char *s,
return
(
PyObject
*
)
v
;
}
PyObject
*
PyUnicode_DecodeMBCS
(
const
char
*
s
,
PyObject
*
PyUnicode_DecodeMBCS
(
const
char
*
s
,
Py_ssize_t
size
,
const
char
*
errors
)
{
...
...
@@ -5010,7 +5060,8 @@ PyObject *PyUnicode_DecodeMBCS(const char *s,
* Convert unicode into string object (MBCS).
* Returns 0 if succeed, -1 otherwise.
*/
static
int
encode_mbcs
(
PyObject
**
repr
,
static
int
encode_mbcs
(
PyObject
**
repr
,
const
Py_UNICODE
*
p
,
/* unicode */
int
size
,
/* size of unicode */
const
char
*
errors
)
...
...
@@ -5086,7 +5137,8 @@ mbcs_encode_error:
return
-
1
;
}
PyObject
*
PyUnicode_EncodeMBCS
(
const
Py_UNICODE
*
p
,
PyObject
*
PyUnicode_EncodeMBCS
(
const
Py_UNICODE
*
p
,
Py_ssize_t
size
,
const
char
*
errors
)
{
...
...
@@ -5117,7 +5169,8 @@ PyObject *PyUnicode_EncodeMBCS(const Py_UNICODE *p,
return
repr
;
}
PyObject
*
PyUnicode_AsMBCSString
(
PyObject
*
unicode
)
PyObject
*
PyUnicode_AsMBCSString
(
PyObject
*
unicode
)
{
if
(
!
PyUnicode_Check
(
unicode
))
{
PyErr_BadArgument
();
...
...
@@ -5134,7 +5187,8 @@ PyObject *PyUnicode_AsMBCSString(PyObject *unicode)
/* --- Character Mapping Codec -------------------------------------------- */
PyObject
*
PyUnicode_DecodeCharmap
(
const
char
*
s
,
PyObject
*
PyUnicode_DecodeCharmap
(
const
char
*
s
,
Py_ssize_t
size
,
PyObject
*
mapping
,
const
char
*
errors
)
...
...
@@ -5297,7 +5351,7 @@ PyObject *PyUnicode_DecodeCharmap(const char *s,
/* Charmap encoding: the lookup table */
struct
encoding_map
{
struct
encoding_map
{
PyObject_HEAD
unsigned
char
level1
[
32
];
int
count2
,
count3
;
...
...
@@ -5511,7 +5565,8 @@ encoding_map_lookup(Py_UNICODE c, PyObject *mapping)
/* Lookup the character ch in the mapping. If the character
can't be found, Py_None is returned (or NULL, if another
error occurred). */
static
PyObject
*
charmapencode_lookup
(
Py_UNICODE
c
,
PyObject
*
mapping
)
static
PyObject
*
charmapencode_lookup
(
Py_UNICODE
c
,
PyObject
*
mapping
)
{
PyObject
*
w
=
PyLong_FromLong
((
long
)
c
);
PyObject
*
x
;
...
...
@@ -5568,15 +5623,15 @@ charmapencode_resize(PyObject **outobj, Py_ssize_t *outpos, Py_ssize_t requireds
typedef
enum
charmapencode_result
{
enc_SUCCESS
,
enc_FAILED
,
enc_EXCEPTION
}
charmapencode_result
;
}
charmapencode_result
;
/* lookup the character, put the result in the output string and adjust
various state variables. Resize the output bytes object if not enough
space is available. Return a new reference to the object that
was put in the output buffer, or Py_None, if the mapping was undefined
(in which case no character was written) or NULL, if a
reallocation error occurred. The caller must decref the result */
static
charmapencode_
result
charmapencode_
output
(
Py_UNICODE
c
,
PyObject
*
mapping
,
static
charmapencode_result
charmapencode_output
(
Py_UNICODE
c
,
PyObject
*
mapping
,
PyObject
**
outobj
,
Py_ssize_t
*
outpos
)
{
PyObject
*
rep
;
...
...
@@ -5633,8 +5688,8 @@ charmapencode_result charmapencode_output(Py_UNICODE c, PyObject *mapping,
/* handle an error in PyUnicode_EncodeCharmap
Return 0 on success, -1 on error */
static
int
charmap_encoding_error
(
static
int
charmap_encoding_error
(
const
Py_UNICODE
*
p
,
Py_ssize_t
size
,
Py_ssize_t
*
inpos
,
PyObject
*
mapping
,
PyObject
**
exceptionObject
,
int
*
known_errorHandler
,
PyObject
**
errorHandler
,
const
char
*
errors
,
...
...
@@ -5768,7 +5823,8 @@ int charmap_encoding_error(
return
0
;
}
PyObject
*
PyUnicode_EncodeCharmap
(
const
Py_UNICODE
*
p
,
PyObject
*
PyUnicode_EncodeCharmap
(
const
Py_UNICODE
*
p
,
Py_ssize_t
size
,
PyObject
*
mapping
,
const
char
*
errors
)
...
...
@@ -5832,7 +5888,8 @@ PyObject *PyUnicode_EncodeCharmap(const Py_UNICODE *p,
return
NULL
;
}
PyObject
*
PyUnicode_AsCharmapString
(
PyObject
*
unicode
,
PyObject
*
PyUnicode_AsCharmapString
(
PyObject
*
unicode
,
PyObject
*
mapping
)
{
if
(
!
PyUnicode_Check
(
unicode
)
||
mapping
==
NULL
)
{
...
...
@@ -5846,7 +5903,8 @@ PyObject *PyUnicode_AsCharmapString(PyObject *unicode,
}
/* create or adjust a UnicodeTranslateError */
static
void
make_translate_exception
(
PyObject
**
exceptionObject
,
static
void
make_translate_exception
(
PyObject
**
exceptionObject
,
const
Py_UNICODE
*
unicode
,
Py_ssize_t
size
,
Py_ssize_t
startpos
,
Py_ssize_t
endpos
,
const
char
*
reason
)
...
...
@@ -5870,7 +5928,8 @@ static void make_translate_exception(PyObject **exceptionObject,
}
/* raises a UnicodeTranslateError */
static
void
raise_translate_exception
(
PyObject
**
exceptionObject
,
static
void
raise_translate_exception
(
PyObject
**
exceptionObject
,
const
Py_UNICODE
*
unicode
,
Py_ssize_t
size
,
Py_ssize_t
startpos
,
Py_ssize_t
endpos
,
const
char
*
reason
)
...
...
@@ -5885,7 +5944,8 @@ static void raise_translate_exception(PyObject **exceptionObject,
build arguments, call the callback and check the arguments,
put the result into newpos and return the replacement string, which
has to be freed by the caller */
static
PyObject
*
unicode_translate_call_errorhandler
(
const
char
*
errors
,
static
PyObject
*
unicode_translate_call_errorhandler
(
const
char
*
errors
,
PyObject
**
errorHandler
,
const
char
*
reason
,
const
Py_UNICODE
*
unicode
,
Py_ssize_t
size
,
PyObject
**
exceptionObject
,
...
...
@@ -5940,8 +6000,8 @@ static PyObject *unicode_translate_call_errorhandler(const char *errors,
/* Lookup the character ch in the mapping and put the result in result,
which must be decrefed by the caller.
Return 0 on success, -1 on error */
static
int
charmaptranslate_lookup
(
Py_UNICODE
c
,
PyObject
*
mapping
,
PyObject
**
result
)
static
int
charmaptranslate_lookup
(
Py_UNICODE
c
,
PyObject
*
mapping
,
PyObject
**
result
)
{
PyObject
*
w
=
PyLong_FromLong
((
long
)
c
);
PyObject
*
x
;
...
...
@@ -5990,8 +6050,8 @@ int charmaptranslate_lookup(Py_UNICODE c, PyObject *mapping, PyObject **result)
/* ensure that *outobj is at least requiredsize characters long,
if not reallocate and adjust various state variables.
Return 0 on success, -1 on error */
static
int
charmaptranslate_makespace
(
PyObject
**
outobj
,
Py_UNICODE
**
outp
,
static
int
charmaptranslate_makespace
(
PyObject
**
outobj
,
Py_UNICODE
**
outp
,
Py_ssize_t
requiredsize
)
{
Py_ssize_t
oldsize
=
PyUnicode_GET_SIZE
(
*
outobj
);
...
...
@@ -6013,8 +6073,8 @@ int charmaptranslate_makespace(PyObject **outobj, Py_UNICODE **outp,
undefined (in which case no character was written).
The called must decref result.
Return 0 on success, -1 on error. */
static
int
charmaptranslate_output
(
const
Py_UNICODE
*
startinp
,
const
Py_UNICODE
*
curinp
,
static
int
charmaptranslate_output
(
const
Py_UNICODE
*
startinp
,
const
Py_UNICODE
*
curinp
,
Py_ssize_t
insize
,
PyObject
*
mapping
,
PyObject
**
outobj
,
Py_UNICODE
**
outp
,
PyObject
**
res
)
{
...
...
@@ -6052,7 +6112,8 @@ int charmaptranslate_output(const Py_UNICODE *startinp, const Py_UNICODE *curinp
return
0
;
}
PyObject
*
PyUnicode_TranslateCharmap
(
const
Py_UNICODE
*
p
,
PyObject
*
PyUnicode_TranslateCharmap
(
const
Py_UNICODE
*
p
,
Py_ssize_t
size
,
PyObject
*
mapping
,
const
char
*
errors
)
...
...
@@ -6194,7 +6255,8 @@ PyObject *PyUnicode_TranslateCharmap(const Py_UNICODE *p,
return
NULL
;
}
PyObject
*
PyUnicode_Translate
(
PyObject
*
str
,
PyObject
*
PyUnicode_Translate
(
PyObject
*
str
,
PyObject
*
mapping
,
const
char
*
errors
)
{
...
...
@@ -6241,7 +6303,8 @@ PyUnicode_TransformDecimalToASCII(Py_UNICODE *s,
}
/* --- Decimal Encoder ---------------------------------------------------- */
int
PyUnicode_EncodeDecimal
(
Py_UNICODE
*
s
,
int
PyUnicode_EncodeDecimal
(
Py_UNICODE
*
s
,
Py_ssize_t
length
,
char
*
output
,
const
char
*
errors
)
...
...
@@ -6405,7 +6468,8 @@ int PyUnicode_EncodeDecimal(Py_UNICODE *s,
start = 0; \
}
Py_ssize_t
PyUnicode_Count
(
PyObject
*
str
,
Py_ssize_t
PyUnicode_Count
(
PyObject
*
str
,
PyObject
*
substr
,
Py_ssize_t
start
,
Py_ssize_t
end
)
...
...
@@ -6435,7 +6499,8 @@ Py_ssize_t PyUnicode_Count(PyObject *str,
return
result
;
}
Py_ssize_t
PyUnicode_Find
(
PyObject
*
str
,
Py_ssize_t
PyUnicode_Find
(
PyObject
*
str
,
PyObject
*
sub
,
Py_ssize_t
start
,
Py_ssize_t
end
,
...
...
@@ -6471,8 +6536,8 @@ Py_ssize_t PyUnicode_Find(PyObject *str,
return
result
;
}
static
int
tailmatch
(
PyUnicodeObject
*
self
,
static
int
tailmatch
(
PyUnicodeObject
*
self
,
PyUnicodeObject
*
substring
,
Py_ssize_t
start
,
Py_ssize_t
end
,
...
...
@@ -6497,7 +6562,8 @@ int tailmatch(PyUnicodeObject *self,
return
0
;
}
Py_ssize_t
PyUnicode_Tailmatch
(
PyObject
*
str
,
Py_ssize_t
PyUnicode_Tailmatch
(
PyObject
*
str
,
PyObject
*
substr
,
Py_ssize_t
start
,
Py_ssize_t
end
,
...
...
@@ -6525,8 +6591,8 @@ Py_ssize_t PyUnicode_Tailmatch(PyObject *str,
/* Apply fixfct filter to the Unicode object self and return a
reference to the modified object */
static
PyObject
*
fixup
(
PyUnicodeObject
*
self
,
static
PyObject
*
fixup
(
PyUnicodeObject
*
self
,
int
(
*
fixfct
)(
PyUnicodeObject
*
s
))
{
...
...
@@ -6549,8 +6615,8 @@ PyObject *fixup(PyUnicodeObject *self,
return
(
PyObject
*
)
u
;
}
static
int
fixupper
(
PyUnicodeObject
*
self
)
static
int
fixupper
(
PyUnicodeObject
*
self
)
{
Py_ssize_t
len
=
self
->
length
;
Py_UNICODE
*
s
=
self
->
str
;
...
...
@@ -6570,8 +6636,8 @@ int fixupper(PyUnicodeObject *self)
return
status
;
}
static
int
fixlower
(
PyUnicodeObject
*
self
)
static
int
fixlower
(
PyUnicodeObject
*
self
)
{
Py_ssize_t
len
=
self
->
length
;
Py_UNICODE
*
s
=
self
->
str
;
...
...
@@ -6591,8 +6657,8 @@ int fixlower(PyUnicodeObject *self)
return
status
;
}
static
int
fixswapcase
(
PyUnicodeObject
*
self
)
static
int
fixswapcase
(
PyUnicodeObject
*
self
)
{
Py_ssize_t
len
=
self
->
length
;
Py_UNICODE
*
s
=
self
->
str
;
...
...
@@ -6612,8 +6678,8 @@ int fixswapcase(PyUnicodeObject *self)
return
status
;
}
static
int
fixcapitalize
(
PyUnicodeObject
*
self
)
static
int
fixcapitalize
(
PyUnicodeObject
*
self
)
{
Py_ssize_t
len
=
self
->
length
;
Py_UNICODE
*
s
=
self
->
str
;
...
...
@@ -6636,8 +6702,8 @@ int fixcapitalize(PyUnicodeObject *self)
return
status
;
}
static
int
fixtitle
(
PyUnicodeObject
*
self
)
static
int
fixtitle
(
PyUnicodeObject
*
self
)
{
register
Py_UNICODE
*
p
=
PyUnicode_AS_UNICODE
(
self
);
register
Py_UNICODE
*
e
;
...
...
@@ -6787,8 +6853,8 @@ PyUnicode_Join(PyObject *separator, PyObject *seq)
return
NULL
;
}
static
PyUnicodeObject
*
pad
(
PyUnicodeObject
*
self
,
static
PyUnicodeObject
*
pad
(
PyUnicodeObject
*
self
,
Py_ssize_t
left
,
Py_ssize_t
right
,
Py_UNICODE
fill
)
...
...
@@ -6822,7 +6888,8 @@ PyUnicodeObject *pad(PyUnicodeObject *self,
return
u
;
}
PyObject
*
PyUnicode_Splitlines
(
PyObject
*
string
,
int
keepends
)
PyObject
*
PyUnicode_Splitlines
(
PyObject
*
string
,
int
keepends
)
{
PyObject
*
list
;
...
...
@@ -6838,8 +6905,8 @@ PyObject *PyUnicode_Splitlines(PyObject *string, int keepends)
return
list
;
}
static
PyObject
*
split
(
PyUnicodeObject
*
self
,
static
PyObject
*
split
(
PyUnicodeObject
*
self
,
PyUnicodeObject
*
substring
,
Py_ssize_t
maxcount
)
{
...
...
@@ -6858,8 +6925,8 @@ PyObject *split(PyUnicodeObject *self,
);
}
static
PyObject
*
rsplit
(
PyUnicodeObject
*
self
,
static
PyObject
*
rsplit
(
PyUnicodeObject
*
self
,
PyUnicodeObject
*
substring
,
Py_ssize_t
maxcount
)
{
...
...
@@ -6878,8 +6945,8 @@ PyObject *rsplit(PyUnicodeObject *self,
);
}
static
PyObject
*
replace
(
PyUnicodeObject
*
self
,
static
PyObject
*
replace
(
PyUnicodeObject
*
self
,
PyUnicodeObject
*
str1
,
PyUnicodeObject
*
str2
,
Py_ssize_t
maxcount
)
...
...
@@ -7216,8 +7283,8 @@ unicode_compare(PyUnicodeObject *str1, PyUnicodeObject *str2)
#endif
int
PyUnicode_Compare
(
PyObject
*
left
,
PyObject
*
right
)
int
PyUnicode_Compare
(
PyObject
*
left
,
PyObject
*
right
)
{
if
(
PyUnicode_Check
(
left
)
&&
PyUnicode_Check
(
right
))
return
unicode_compare
((
PyUnicodeObject
*
)
left
,
...
...
@@ -7253,9 +7320,8 @@ PyUnicode_CompareWithASCIIString(PyObject* uni, const char* str)
#define TEST_COND(cond) \
((cond) ? Py_True : Py_False)
PyObject
*
PyUnicode_RichCompare
(
PyObject
*
left
,
PyObject
*
right
,
int
op
)
PyObject
*
PyUnicode_RichCompare
(
PyObject
*
left
,
PyObject
*
right
,
int
op
)
{
int
result
;
...
...
@@ -7310,8 +7376,8 @@ PyObject *PyUnicode_RichCompare(PyObject *left,
return
Py_NotImplemented
;
}
int
PyUnicode_Contains
(
PyObject
*
container
,
PyObject
*
element
)
int
PyUnicode_Contains
(
PyObject
*
container
,
PyObject
*
element
)
{
PyObject
*
str
,
*
sub
;
int
result
;
...
...
@@ -7341,8 +7407,8 @@ int PyUnicode_Contains(PyObject *container,
/* Concat to string or Unicode object giving a new Unicode object. */
PyObject
*
PyUnicode_Concat
(
PyObject
*
left
,
PyObject
*
right
)
PyObject
*
PyUnicode_Concat
(
PyObject
*
left
,
PyObject
*
right
)
{
PyUnicodeObject
*
u
=
NULL
,
*
v
=
NULL
,
*
w
;
...
...
@@ -8258,7 +8324,8 @@ unicode_repeat(PyUnicodeObject *str, Py_ssize_t len)
return
(
PyObject
*
)
u
;
}
PyObject
*
PyUnicode_Replace
(
PyObject
*
obj
,
PyObject
*
PyUnicode_Replace
(
PyObject
*
obj
,
PyObject
*
subobj
,
PyObject
*
replobj
,
Py_ssize_t
maxcount
)
...
...
@@ -8325,8 +8392,8 @@ unicode_replace(PyUnicodeObject *self, PyObject *args)
return
result
;
}
static
PyObject
*
unicode_repr
(
PyObject
*
unicode
)
static
PyObject
*
unicode_repr
(
PyObject
*
unicode
)
{
PyObject
*
repr
;
Py_UNICODE
*
p
;
...
...
@@ -8559,9 +8626,8 @@ unicode_rjust(PyUnicodeObject *self, PyObject *args)
return
(
PyObject
*
)
pad
(
self
,
width
-
self
->
length
,
0
,
fillchar
);
}
PyObject
*
PyUnicode_Split
(
PyObject
*
s
,
PyObject
*
sep
,
Py_ssize_t
maxsplit
)
PyObject
*
PyUnicode_Split
(
PyObject
*
s
,
PyObject
*
sep
,
Py_ssize_t
maxsplit
)
{
PyObject
*
result
;
...
...
@@ -8690,9 +8756,8 @@ unicode_rpartition(PyUnicodeObject *self, PyObject *separator)
return
PyUnicode_RPartition
((
PyObject
*
)
self
,
separator
);
}
PyObject
*
PyUnicode_RSplit
(
PyObject
*
s
,
PyObject
*
sep
,
Py_ssize_t
maxsplit
)
PyObject
*
PyUnicode_RSplit
(
PyObject
*
s
,
PyObject
*
sep
,
Py_ssize_t
maxsplit
)
{
PyObject
*
result
;
...
...
@@ -9384,8 +9449,8 @@ formatchar(Py_UNICODE *buf,
*/
#define FORMATBUFLEN (size_t)10
PyObject
*
PyUnicode_Format
(
PyObject
*
format
,
PyObject
*
args
)
PyObject
*
PyUnicode_Format
(
PyObject
*
format
,
PyObject
*
args
)
{
Py_UNICODE
*
fmt
,
*
res
;
Py_ssize_t
fmtcnt
,
rescnt
,
reslen
,
arglen
,
argidx
;
...
...
@@ -10076,7 +10141,8 @@ PyUnicode_InternFromString(const char *cp)
return
s
;
}
void
_Py_ReleaseInternedUnicodeStrings
(
void
)
void
_Py_ReleaseInternedUnicodeStrings
(
void
)
{
PyObject
*
keys
;
PyUnicodeObject
*
s
;
...
...
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