summaryrefslogtreecommitdiffstats
path: root/Objects/stringobject.c
diff options
context:
space:
mode:
authorFredrik Lundh <fredrik@pythonware.com>2006-05-26 17:26:39 (GMT)
committerFredrik Lundh <fredrik@pythonware.com>2006-05-26 17:26:39 (GMT)
commitc2032fb86ad05534afccad9801e794b0971e2541 (patch)
treebe371723d513cb0a4488c148de8d758119a48e99 /Objects/stringobject.c
parentb947948c6148cdb5ebd75fb5f9ff66b598c4ead0 (diff)
downloadcpython-c2032fb86ad05534afccad9801e794b0971e2541.zip
cpython-c2032fb86ad05534afccad9801e794b0971e2541.tar.gz
cpython-c2032fb86ad05534afccad9801e794b0971e2541.tar.bz2
needforspeed: cleanup
Diffstat (limited to 'Objects/stringobject.c')
-rw-r--r--Objects/stringobject.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 3790bfa..c4a6a70 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -1544,8 +1544,8 @@ found, returns S and two empty strings.");
static PyObject *
string_partition(PyStringObject *self, PyObject *sep_obj)
{
- Py_ssize_t str_len = PyString_GET_SIZE(self), sep_len;
- const char *str = PyString_AS_STRING(self), *sep;
+ const char *sep;
+ Py_ssize_t sep_len;
if (PyString_Check(sep_obj)) {
sep = PyString_AS_STRING(sep_obj);
@@ -1553,12 +1553,16 @@ string_partition(PyStringObject *self, PyObject *sep_obj)
}
#ifdef Py_USING_UNICODE
else if (PyUnicode_Check(sep_obj))
- return PyUnicode_Partition((PyObject *)self, sep_obj);
+ return PyUnicode_Partition((PyObject *) self, sep_obj);
#endif
else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len))
return NULL;
- return partition((PyObject*)self, str, str_len, sep_obj, sep, sep_len);
+ return partition(
+ (PyObject*) self,
+ PyString_AS_STRING(self), PyString_GET_SIZE(self),
+ sep_obj, sep, sep_len
+ );
}
Py_LOCAL(PyObject *)