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
157f83fc
Commit
157f83fc
authored
Sep 28, 2011
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Strip trailing spaces in unicodeobject.[ch]
parent
6c7a52a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
15 deletions
+15
-15
Include/unicodeobject.h
Include/unicodeobject.h
+5
-5
Objects/unicodeobject.c
Objects/unicodeobject.c
+10
-10
No files found.
Include/unicodeobject.h
View file @
157f83fc
...
...
@@ -356,13 +356,13 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
#define PyUnicode_IS_COMPACT(op) \
(((PyASCIIObject*)(op))->state.compact)
/* Return one of the PyUnicode_*_KIND values defined above. */
/* Return one of the PyUnicode_*_KIND values defined above. */
#define PyUnicode_KIND(op) \
(assert(PyUnicode_Check(op)), \
assert(PyUnicode_IS_READY(op)), \
((PyASCIIObject *)(op))->state.kind)
/* Return a void pointer to the raw unicode buffer. */
/* Return a void pointer to the raw unicode buffer. */
#define _PyUnicode_COMPACT_DATA(op) \
(PyUnicode_IS_COMPACT_ASCII(op) ? \
((void*)((PyASCIIObject*)(op) + 1)) : \
...
...
@@ -509,7 +509,7 @@ PyAPI_FUNC(PyObject*) PyUnicode_New(
/* Initializes the canonical string representation from a the deprected
wstr/Py_UNICODE representation. This function is used to convert
unicode objects which were created using the old API to the new flexible
unicode objects which were created using the old API to the new flexible
format introduced with PEP 393. The PyUnicode_READY() macro can be
more efficient if the string is already ready. */
#ifndef Py_LIMITED_API
...
...
@@ -641,7 +641,7 @@ PyAPI_FUNC(Py_ssize_t) PyUnicode_GetLength(
PyObject
*
unicode
);
/* Get the number of Py_UNICODE units in the
/* Get the number of Py_UNICODE units in the
string representation. */
PyAPI_FUNC
(
Py_ssize_t
)
PyUnicode_GetSize
(
...
...
@@ -857,7 +857,7 @@ PyAPI_FUNC(int) PyUnicode_ClearFreeList(void);
In case of an error, no *size is set.
This funcation caches the UTF-8 encoded string in the unicodeobject
This funcation caches the UTF-8 encoded string in the unicodeobject
and subsequent calls will return the same string. The memory is relased
when the unicodeobject is deallocated.
...
...
Objects/unicodeobject.c
View file @
157f83fc
...
...
@@ -643,7 +643,7 @@ PyUnicode_CopyCharacters(PyObject *to, Py_ssize_t to_start,
PyUnicode_KIND_SIZE
(
to_kind
,
how_many
));
return
how_many
;
}
if
(
from_kind
>
to_kind
)
{
/* slow path to check for character overflow */
const
Py_UCS4
to_maxchar
=
PyUnicode_MAX_CHAR_VALUE
(
to
);
...
...
@@ -678,7 +678,7 @@ PyUnicode_CopyCharacters(PyObject *to, Py_ssize_t to_start,
);
return
how_many
;
}
else
if
(
from_kind
==
PyUnicode_1BYTE_KIND
else
if
(
from_kind
==
PyUnicode_1BYTE_KIND
&&
to_kind
==
PyUnicode_4BYTE_KIND
)
{
_PyUnicode_CONVERT_BYTES
(
...
...
@@ -703,7 +703,7 @@ PyUnicode_CopyCharacters(PyObject *to, Py_ssize_t to_start,
PyErr_Format
(
PyExc_ValueError
,
"Cannot copy UCS%u characters "
"into a string of UCS%u characters"
,
1
<<
(
from_kind
-
1
),
1
<<
(
from_kind
-
1
),
1
<<
(
to_kind
-
1
));
return
-
1
;
}
...
...
@@ -8155,8 +8155,8 @@ fixup(PyUnicodeObject *self,
/* If the maxchar increased so that the kind changed, not all
characters are representable anymore and we need to fix the
string again. This only happens in very few cases. */
if
(
PyUnicode_CopyCharacters
(
v
,
0
,
(
PyObject
*
)
self
,
0
,
if
(
PyUnicode_CopyCharacters
(
v
,
0
,
(
PyObject
*
)
self
,
0
,
PyUnicode_GET_LENGTH
(
self
))
<
0
)
{
Py_DECREF
(
u
);
...
...
@@ -8166,8 +8166,8 @@ fixup(PyUnicodeObject *self,
assert
(
maxchar_old
>
0
&&
maxchar_old
<=
maxchar_new
);
}
else
{
if
(
PyUnicode_CopyCharacters
(
v
,
0
,
u
,
0
,
if
(
PyUnicode_CopyCharacters
(
v
,
0
,
u
,
0
,
PyUnicode_GET_LENGTH
(
self
))
<
0
)
{
Py_DECREF
(
u
);
...
...
@@ -8558,8 +8558,8 @@ pad(PyUnicodeObject *self,
FILL
(
kind
,
data
,
fill
,
0
,
left
);
if
(
right
)
FILL
(
kind
,
data
,
fill
,
left
+
_PyUnicode_LENGTH
(
self
),
right
);
if
(
PyUnicode_CopyCharacters
(
u
,
left
,
(
PyObject
*
)
self
,
0
,
if
(
PyUnicode_CopyCharacters
(
u
,
left
,
(
PyObject
*
)
self
,
0
,
_PyUnicode_LENGTH
(
self
))
<
0
)
{
Py_DECREF
(
u
);
...
...
@@ -9479,7 +9479,7 @@ PyUnicode_Concat(PyObject *left, PyObject *right)
goto
onError
;
if
(
PyUnicode_CopyCharacters
(
w
,
0
,
u
,
0
,
PyUnicode_GET_LENGTH
(
u
))
<
0
)
goto
onError
;
if
(
PyUnicode_CopyCharacters
(
w
,
PyUnicode_GET_LENGTH
(
u
),
if
(
PyUnicode_CopyCharacters
(
w
,
PyUnicode_GET_LENGTH
(
u
),
v
,
0
,
PyUnicode_GET_LENGTH
(
v
))
<
0
)
goto
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