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
619f16e1
Commit
619f16e1
authored
Jun 09, 2010
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #8930: fix some C code indentation
parent
ae1bb9a0
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
285 additions
and
285 deletions
+285
-285
Modules/_codecsmodule.c
Modules/_codecsmodule.c
+68
-68
Objects/bytearrayobject.c
Objects/bytearrayobject.c
+45
-45
Objects/stringobject.c
Objects/stringobject.c
+172
-172
No files found.
Modules/_codecsmodule.c
View file @
619f16e1
This diff is collapsed.
Click to expand it.
Objects/bytearrayobject.c
View file @
619f16e1
...
...
@@ -106,24 +106,24 @@ bytearray_buffer_getcharbuf(PyByteArrayObject *self, Py_ssize_t index, const cha
static
int
bytearray_getbuffer
(
PyByteArrayObject
*
obj
,
Py_buffer
*
view
,
int
flags
)
{
int
ret
;
void
*
ptr
;
if
(
view
==
NULL
)
{
obj
->
ob_exports
++
;
return
0
;
}
ptr
=
(
void
*
)
PyByteArray_AS_STRING
(
obj
);
ret
=
PyBuffer_FillInfo
(
view
,
(
PyObject
*
)
obj
,
ptr
,
Py_SIZE
(
obj
),
0
,
flags
);
if
(
ret
>=
0
)
{
obj
->
ob_exports
++
;
}
return
ret
;
int
ret
;
void
*
ptr
;
if
(
view
==
NULL
)
{
obj
->
ob_exports
++
;
return
0
;
}
ptr
=
(
void
*
)
PyByteArray_AS_STRING
(
obj
);
ret
=
PyBuffer_FillInfo
(
view
,
(
PyObject
*
)
obj
,
ptr
,
Py_SIZE
(
obj
),
0
,
flags
);
if
(
ret
>=
0
)
{
obj
->
ob_exports
++
;
}
return
ret
;
}
static
void
bytearray_releasebuffer
(
PyByteArrayObject
*
obj
,
Py_buffer
*
view
)
{
obj
->
ob_exports
--
;
obj
->
ob_exports
--
;
}
static
Py_ssize_t
...
...
@@ -1718,43 +1718,43 @@ replace_single_character_in_place(PyByteArrayObject *self,
char
from_c
,
char
to_c
,
Py_ssize_t
maxcount
)
{
char
*
self_s
,
*
result_s
,
*
start
,
*
end
,
*
next
;
Py_ssize_t
self_len
;
PyByteArrayObject
*
result
;
char
*
self_s
,
*
result_s
,
*
start
,
*
end
,
*
next
;
Py_ssize_t
self_len
;
PyByteArrayObject
*
result
;
/* The result string will be the same size */
self_s
=
PyByteArray_AS_STRING
(
self
);
self_len
=
PyByteArray_GET_SIZE
(
self
);
/* The result string will be the same size */
self_s
=
PyByteArray_AS_STRING
(
self
);
self_len
=
PyByteArray_GET_SIZE
(
self
);
next
=
findchar
(
self_s
,
self_len
,
from_c
);
next
=
findchar
(
self_s
,
self_len
,
from_c
);
if
(
next
==
NULL
)
{
/* No matches; return the original bytes */
return
return_self
(
self
);
}
if
(
next
==
NULL
)
{
/* No matches; return the original bytes */
return
return_self
(
self
);
}
/* Need to make a new bytes */
result
=
(
PyByteArrayObject
*
)
PyByteArray_FromStringAndSize
(
NULL
,
self_len
);
if
(
result
==
NULL
)
return
NULL
;
result_s
=
PyByteArray_AS_STRING
(
result
);
Py_MEMCPY
(
result_s
,
self_s
,
self_len
);
/* change everything in-place, starting with this one */
start
=
result_s
+
(
next
-
self_s
);
*
start
=
to_c
;
start
++
;
end
=
result_s
+
self_len
;
while
(
--
maxcount
>
0
)
{
next
=
findchar
(
start
,
end
-
start
,
from_c
);
if
(
next
==
NULL
)
break
;
*
next
=
to_c
;
start
=
next
+
1
;
}
/* Need to make a new bytes */
result
=
(
PyByteArrayObject
*
)
PyByteArray_FromStringAndSize
(
NULL
,
self_len
);
if
(
result
==
NULL
)
return
NULL
;
result_s
=
PyByteArray_AS_STRING
(
result
);
Py_MEMCPY
(
result_s
,
self_s
,
self_len
);
/* change everything in-place, starting with this one */
start
=
result_s
+
(
next
-
self_s
);
*
start
=
to_c
;
start
++
;
end
=
result_s
+
self_len
;
return
result
;
while
(
--
maxcount
>
0
)
{
next
=
findchar
(
start
,
end
-
start
,
from_c
);
if
(
next
==
NULL
)
break
;
*
next
=
to_c
;
start
=
next
+
1
;
}
return
result
;
}
/* len(self)>=1, len(from)==len(to)>=2, maxcount>=1 */
...
...
Objects/stringobject.c
View file @
619f16e1
This diff is collapsed.
Click to expand it.
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