Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
5330ab1e
Commit
5330ab1e
authored
May 19, 2012
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix array optimization in C++.
parent
6416e38e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
Cython/Includes/cpython/arrayarray.h
Cython/Includes/cpython/arrayarray.h
+4
-4
No files found.
Cython/Includes/cpython/arrayarray.h
View file @
5330ab1e
...
...
@@ -117,13 +117,13 @@ PyObject* newarrayobject(PyTypeObject *type, Py_ssize_t size,
/* fast resize (reallocation to the point)
not designed for filing small increments (but for fast opaque array apps) */
int
resize
(
arrayobject
*
self
,
Py_ssize_t
n
)
{
void
*
item
=
self
->
ob_item
;
void
*
item
=
(
void
*
)
self
->
ob_item
;
PyMem_Resize
(
item
,
char
,
(
size_t
)(
n
*
self
->
ob_descr
->
itemsize
));
if
(
item
==
NULL
)
{
PyErr_NoMemory
();
return
-
1
;
}
self
->
ob_item
=
item
;
self
->
ob_item
=
(
char
*
)
item
;
self
->
ob_size
=
n
;
#if PY_VERSION_HEX >= 0x02040000
self
->
allocated
=
n
;
...
...
@@ -135,7 +135,7 @@ int resize(arrayobject *self, Py_ssize_t n) {
Remains non-smart in Python 2.3- ; but exists for compatibility */
int
resize_smart
(
arrayobject
*
self
,
Py_ssize_t
n
)
{
#if PY_VERSION_HEX >= 0x02040000
void
*
item
=
self
->
ob_item
;
void
*
item
=
(
void
*
)
self
->
ob_item
;
Py_ssize_t
newsize
;
if
(
n
<
self
->
allocated
)
{
if
(
n
*
4
>
self
->
allocated
)
{
...
...
@@ -149,7 +149,7 @@ int resize_smart(arrayobject *self, Py_ssize_t n) {
PyErr_NoMemory
();
return
-
1
;
}
self
->
ob_item
=
item
;
self
->
ob_item
=
(
char
*
)
item
;
self
->
ob_size
=
n
;
self
->
allocated
=
newsize
;
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment