summaryrefslogtreecommitdiff
path: root/Objects/bytearrayobject.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-06-09 16:58:35 +0000
committerAntoine Pitrou <solipsis@pitrou.net>2010-06-09 16:58:35 +0000
commita57aae7d47a20b2cb579b51192d39b9d0521c979 (patch)
tree8adb8a74497855f96e914ff8750e41ec9b784807 /Objects/bytearrayobject.c
parent839d5f99f3bf90aff03a18a1ea8584b75d7d2745 (diff)
downloadcpython-git-a57aae7d47a20b2cb579b51192d39b9d0521c979.tar.gz
Merged revisions 81862 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r81862 | antoine.pitrou | 2010-06-09 18:38:55 +0200 (mer., 09 juin 2010) | 9 lines Merged revisions 81860 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r81860 | antoine.pitrou | 2010-06-09 18:24:00 +0200 (mer., 09 juin 2010) | 3 lines Issue #8930: fix some C code indentation ........ ................
Diffstat (limited to 'Objects/bytearrayobject.c')
-rw-r--r--Objects/bytearrayobject.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c
index 18e6f8d8ec..4878d83162 100644
--- a/Objects/bytearrayobject.c
+++ b/Objects/bytearrayobject.c
@@ -1756,43 +1756,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;
+
+ while (--maxcount > 0) {
+ next = findchar(start, end-start, from_c);
+ if (next == NULL)
+ break;
+ *next = to_c;
+ start = next+1;
+ }
- return result;
+ return result;
}
/* len(self)>=1, len(from)==len(to)>=2, maxcount>=1 */