Mercurial > cpython-lru_cache-weakref
diff Objects/stringobject.c @ 38738:0a8a392e1fae legacy-trunk
Update doc to make it agree with code.
Bottom factor out some common code.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Sun, 11 Jun 2006 05:47:14 +0000 |
| parents | 67450db26f81 |
| children | 041eb6231cdc |
line wrap: on
line diff
--- a/Objects/stringobject.c Sun Jun 11 05:45:47 2006 +0000 +++ b/Objects/stringobject.c Sun Jun 11 05:47:14 2006 +0000 @@ -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; }
