if (unicode->str) {
/* Keep-Alive optimization: we only upsize the buffer,
never downsize it. */
- if ((unicode->length < length) &&
- unicode_resize(unicode, length)) {
+ if ((unicode->length < length) &&
+ unicode_resize(unicode, length) < 0) {
PyMem_DEL(unicode->str);
goto onError;
}
}
}
-int PyUnicode_Resize(PyObject **unicode,
- int length)
+int PyUnicode_Resize(PyObject **unicode, int length)
{
register PyUnicodeObject *v;
if (requiredsize > outsize) {
if (requiredsize<2*outsize)
requiredsize = 2*outsize;
- if (PyUnicode_Resize(output, requiredsize))
+ if (PyUnicode_Resize(output, requiredsize) < 0)
goto onError;
*outptr = PyUnicode_AS_UNICODE(*output) + *outpos;
}
goto restart;
}
- if (_PyUnicode_Resize(&unicode, p - PyUnicode_AS_UNICODE(unicode)))
+ if (_PyUnicode_Resize(&unicode, p - PyUnicode_AS_UNICODE(unicode)) < 0)
goto onError;
Py_XDECREF(errorHandler);
}
/* Adjust length */
- if (_PyUnicode_Resize(&unicode, p - unicode->str))
+ if (_PyUnicode_Resize(&unicode, p - unicode->str) < 0)
goto onError;
Py_XDECREF(errorHandler);
*byteorder = bo;
/* Adjust length */
- if (_PyUnicode_Resize(&unicode, p - unicode->str))
+ if (_PyUnicode_Resize(&unicode, p - unicode->str) < 0)
goto onError;
Py_XDECREF(errorHandler);
nextByte:
;
}
- if (_PyUnicode_Resize(&v, (int)(p - PyUnicode_AS_UNICODE(v))))
+ if (_PyUnicode_Resize(&v, (int)(p - PyUnicode_AS_UNICODE(v))) < 0)
goto onError;
Py_XDECREF(errorHandler);
Py_XDECREF(exc);
nextByte:
;
}
- if (_PyUnicode_Resize(&v, (int)(p - PyUnicode_AS_UNICODE(v))))
+ if (_PyUnicode_Resize(&v, (int)(p - PyUnicode_AS_UNICODE(v))) < 0)
goto onError;
Py_XDECREF(errorHandler);
Py_XDECREF(exc);
}
}
if (p - PyUnicode_AS_UNICODE(v) < PyString_GET_SIZE(v))
- if (_PyUnicode_Resize(&v, (int)(p - PyUnicode_AS_UNICODE(v))))
+ if (_PyUnicode_Resize(&v, (int)(p - PyUnicode_AS_UNICODE(v))) < 0)
goto onError;
Py_XDECREF(errorHandler);
Py_XDECREF(exc);
(targetsize << 2);
extrachars += needed;
if (_PyUnicode_Resize(&v,
- PyUnicode_GET_SIZE(v) + needed)) {
+ PyUnicode_GET_SIZE(v) + needed) < 0) {
Py_DECREF(x);
goto onError;
}
++s;
}
if (p - PyUnicode_AS_UNICODE(v) < PyUnicode_GET_SIZE(v))
- if (_PyUnicode_Resize(&v, (int)(p - PyUnicode_AS_UNICODE(v))))
+ if (_PyUnicode_Resize(&v, (int)(p - PyUnicode_AS_UNICODE(v))) < 0)
goto onError;
Py_XDECREF(errorHandler);
Py_XDECREF(exc);
/* exponentially overallocate to minimize reallocations */
if (requiredsize < 2 * *outsize)
requiredsize = 2 * *outsize;
- if (_PyUnicode_Resize(outobj, requiredsize))
+ if (_PyUnicode_Resize(outobj, requiredsize) < 0)
return -1;
*outp = PyUnicode_AS_UNICODE(*outobj) + outpos;
*outsize = requiredsize;
/* Resize if we allocated to much */
respos = str-PyUnicode_AS_UNICODE(res);
if (respos<ressize) {
- if (_PyUnicode_Resize(&res, respos))
+ if (_PyUnicode_Resize(&res, respos) < 0)
goto onError;
}
Py_XDECREF(exc);
}
itemlen = PyUnicode_GET_SIZE(item);
while (reslen + itemlen + seplen >= sz) {
- if (_PyUnicode_Resize(&res, sz*2)) {
+ if (_PyUnicode_Resize(&res, sz*2) < 0) {
Py_DECREF(item);
goto onError;
}
reslen += itemlen;
Py_DECREF(item);
}
- if (_PyUnicode_Resize(&res, reslen))
+ if (_PyUnicode_Resize(&res, reslen) < 0)
goto onError;
Py_XDECREF(separator);
Py_DECREF(args);
}
Py_DECREF(uformat);
- if (_PyUnicode_Resize(&result, reslen - rescnt))
+ if (_PyUnicode_Resize(&result, reslen - rescnt) < 0)
goto onError;
return (PyObject *)result;