summaryrefslogtreecommitdiff
path: root/Objects
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-06-11 05:47:14 +0000
committerNeal Norwitz <nnorwitz@gmail.com>2006-06-11 05:47:14 +0000
commit8e6675a7dcaa71b1d8b5e094ea15bc21d13376f0 (patch)
treea324697e37202eba841653f819ea077070887bfb /Objects
parenta754a229b408375bc7b939a8adf3452dc8176da6 (diff)
downloadcpython-git-8e6675a7dcaa71b1d8b5e094ea15bc21d13376f0.tar.gz
Update doc to make it agree with code.
Bottom factor out some common code.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/stringobject.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index a5c8cc2870..92477eea0c 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -3099,7 +3099,7 @@ string_replace(PyStringObject *self, PyObject *args)
/** End DALKE **/
-/* Matches the end (direction > 0) or start (direction < 0) of self
+/* Matches the end (direction >= 0) or start (direction < 0) of self
* against substr, using the start and end arguments. Returns
* -1 on error, 0 if not found and 1 if found.
*/
@@ -3131,11 +3131,6 @@ _string_tailmatch(PyStringObject *self, PyObject *substr, Py_ssize_t start,
/* startswith */
if (start+slen > len)
return 0;
-
- if (end-start >= slen)
- return ! memcmp(str+start, sub, slen);
- else
- return 0;
} else {
/* endswith */
if (end-start < slen || start > len)
@@ -3143,11 +3138,10 @@ _string_tailmatch(PyStringObject *self, PyObject *substr, Py_ssize_t start,
if (end-slen > start)
start = end - slen;
- if (end-start >= slen)
- return ! memcmp(str+start, sub, slen);
- else
- return 0;
}
+ if (end-start >= slen)
+ return ! memcmp(str+start, sub, slen);
+ return 0;
}