summaryrefslogtreecommitdiffstats
path: root/Objects/stringlib
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-05-27 05:21:30 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-05-27 05:21:30 (GMT)
commitd1b6cd7bfb35ffecd8b52d9d2b3cd608ab6515e0 (patch)
tree34ad16ca127a572f8ecde22277e51e5d520ec0a7 /Objects/stringlib
parent2f3136b8f0b4845b29b2d7363ae2181a06b79750 (diff)
downloadcpython-d1b6cd7bfb35ffecd8b52d9d2b3cd608ab6515e0.zip
cpython-d1b6cd7bfb35ffecd8b52d9d2b3cd608ab6515e0.tar.gz
cpython-d1b6cd7bfb35ffecd8b52d9d2b3cd608ab6515e0.tar.bz2
Fix Coverity warnings.
- Check the correct variable (str_obj, not str) for NULL - sep_len was already verified it wasn't 0
Diffstat (limited to 'Objects/stringlib')
-rw-r--r--Objects/stringlib/partition.h7
1 files changed, 1 insertions, 6 deletions
diff --git a/Objects/stringlib/partition.h b/Objects/stringlib/partition.h
index 8cc7abe..11a12c6 100644
--- a/Objects/stringlib/partition.h
+++ b/Objects/stringlib/partition.h
@@ -58,7 +58,7 @@ stringlib_rpartition(
)
{
PyObject* out;
- Py_ssize_t pos;
+ Py_ssize_t pos, j;
if (sep_len == 0) {
PyErr_SetString(PyExc_ValueError, "empty separator");
@@ -70,17 +70,12 @@ stringlib_rpartition(
return NULL;
/* XXX - create reversefastsearch helper! */
- if (sep_len == 0)
- pos = str_len;
- else {
- Py_ssize_t j;
pos = -1;
for (j = str_len - sep_len; j >= 0; --j)
if (STRINGLIB_CMP(str+j, sep, sep_len) == 0) {
pos = j;
break;
}
- }
if (pos < 0) {
Py_INCREF(str_obj);