Commit be8fad9d authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix: can't call things realloc

parent 47849c8b
......@@ -77,7 +77,7 @@ PyAPI_FUNC(void) PyMem_Free(void *) PYSTON_NOEXCEPT;
: malloc((n) ? (n) : 1))
#define PyMem_REALLOC(p, n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \
: realloc((p), (n) ? (n) : 1))
#define PyMem_FREE PyMem_Free
#define PyMem_FREE free
#endif /* PYMALLOC_DEBUG */
......
......@@ -146,7 +146,7 @@ void BoxedList::shrink() {
if (capacity > size * 3) {
int new_capacity = std::max(static_cast<int64_t>(INITIAL_CAPACITY), capacity / 2);
if (size > 0) {
elts = GCdArray::realloc(elts, new_capacity);
elts = GCdArray::grow(elts, new_capacity);
capacity = new_capacity;
} else if (size == 0) {
delete elts;
......
......@@ -29,7 +29,7 @@ inline void BoxedList::grow(int min_free) {
capacity = initial;
} else {
int new_capacity = std::max(capacity * 2, size + min_free);
elts = GCdArray::realloc(elts, new_capacity);
elts = GCdArray::grow(elts, new_capacity);
capacity = new_capacity;
}
}
......
......@@ -538,7 +538,7 @@ public:
void operator delete(void* p) { PyMem_FREE(p); }
static GCdArray* realloc(GCdArray* array, int capacity) {
static GCdArray* grow(GCdArray* array, int capacity) {
return (GCdArray*)PyMem_REALLOC(array, capacity * sizeof(Box*) + sizeof(GCdArray));
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment