diff options
| author | orivej <[email protected]> | 2022-02-10 16:45:01 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:45:01 +0300 |
| commit | 2d37894b1b037cf24231090eda8589bbb44fb6fc (patch) | |
| tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/tools/cython/Cython/Utility/arrayarray.h | |
| parent | 718c552901d703c502ccbefdfc3c9028d608b947 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/cython/Cython/Utility/arrayarray.h')
| -rw-r--r-- | contrib/tools/cython/Cython/Utility/arrayarray.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/contrib/tools/cython/Cython/Utility/arrayarray.h b/contrib/tools/cython/Cython/Utility/arrayarray.h index e9558ca6c36..a9e49237856 100644 --- a/contrib/tools/cython/Cython/Utility/arrayarray.h +++ b/contrib/tools/cython/Cython/Utility/arrayarray.h @@ -125,20 +125,20 @@ static CYTHON_INLINE int resize(arrayobject *self, Py_ssize_t n) { static CYTHON_INLINE int resize_smart(arrayobject *self, Py_ssize_t n) { void *items = (void*) self->data.ob_item; Py_ssize_t newsize; - if (n < self->allocated && n*4 > self->allocated) { + if (n < self->allocated && n*4 > self->allocated) { __Pyx_SET_SIZE(self, n); - return 0; + return 0; + } + newsize = n + (n / 2) + 1; + if (newsize <= n) { /* overflow */ + PyErr_NoMemory(); + return -1; } - newsize = n + (n / 2) + 1; - if (newsize <= n) { /* overflow */ - PyErr_NoMemory(); - return -1; - } PyMem_Resize(items, char, (size_t)(newsize * self->ob_descr->itemsize)); if (items == NULL) { PyErr_NoMemory(); return -1; - } + } self->data.ob_item = (char*) items; __Pyx_SET_SIZE(self, n); self->allocated = newsize; |
