diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2008-01-26 20:24:36 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2008-01-26 20:24:36 (GMT) |
commit | 739a3c40e607dbdb5913197a3c869bb445b7fe04 (patch) | |
tree | 3f3f6ead16fb9da3ff731e89ab379e57c130ae54 /Modules | |
parent | d006380fe1b0fc53af06946bddf52c7e54e37e21 (diff) | |
download | cpython-739a3c40e607dbdb5913197a3c869bb445b7fe04.zip cpython-739a3c40e607dbdb5913197a3c869bb445b7fe04.tar.gz cpython-739a3c40e607dbdb5913197a3c869bb445b7fe04.tar.bz2 |
Cleanup the code a bit. test_rfind is failing on PPC and PPC64 buildbots,
this might fix the problem.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/mmapmodule.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index bc153c9..e808d87 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -253,8 +253,8 @@ mmap_gfind(mmap_object *self, int reverse) { Py_ssize_t start = self->pos; - Py_ssize_t end = self->size; - char *needle; + Py_ssize_t end = self->size; + const char *needle; Py_ssize_t len; CHECK_VALID(NULL); @@ -262,7 +262,7 @@ mmap_gfind(mmap_object *self, &needle, &len, &start, &end)) { return NULL; } else { - char *p; + const char *p, *start_p, *end_p; char sign = reverse ? -1 : 1; if (start < 0) @@ -279,11 +279,11 @@ mmap_gfind(mmap_object *self, else if ((size_t)end > self->size) end = self->size; - start += (Py_ssize_t)self->data; - end += (Py_ssize_t)self->data; + start_p = self->data + start; + end_p = self->data + end; - for (p = (char *)(reverse ? end - len : start); - p >= (char *)start && p + len <= (char *)end; p+=sign) { + for (p = (reverse ? end_p - len : start_p); + (p >= start_p) && (p + len <= end_p); p += sign) { Py_ssize_t i; for (i = 0; i < len && needle[i] == p[i]; ++i) /* nothing */; |