[Python-checkins] r46853 - python/trunk/Objects/stringobject.c
neal.norwitz
python-checkins at python.org
Sun Jun 11 07:47:15 CEST 2006
Author: neal.norwitz
Date: Sun Jun 11 07:47:14 2006
New Revision: 46853
Modified:
python/trunk/Objects/stringobject.c
Log:
Update doc to make it agree with code.
Bottom factor out some common code.
Modified: python/trunk/Objects/stringobject.c
==============================================================================
--- python/trunk/Objects/stringobject.c (original)
+++ python/trunk/Objects/stringobject.c Sun Jun 11 07:47:14 2006
@@ -3099,7 +3099,7 @@
/** 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 @@
/* 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 @@
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;
}
More information about the Python-checkins
mailing list