]> granicus.if.org Git - python/commitdiff
needforspeed: cleanup
authorFredrik Lundh <fredrik@pythonware.com>
Fri, 26 May 2006 17:26:39 +0000 (17:26 +0000)
committerFredrik Lundh <fredrik@pythonware.com>
Fri, 26 May 2006 17:26:39 +0000 (17:26 +0000)
Objects/stringobject.c

index 3790bfa3c803ff2ab23fd96d48045417571a27c8..c4a6a7057048e3387bdedff0dafb525d97a6f927 100644 (file)
@@ -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 *)