bug fix
This commit is contained in:
@@ -71,12 +71,13 @@ namespace TinySTL{
|
|||||||
void alloc::deallocate(void *ptr, size_t bytes){
|
void alloc::deallocate(void *ptr, size_t bytes){
|
||||||
if (bytes > EMaxBytes::MAXBYTES){
|
if (bytes > EMaxBytes::MAXBYTES){
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}else{
|
||||||
size_t index = FREELIST_INDEX(bytes);
|
size_t index = FREELIST_INDEX(bytes);
|
||||||
obj *node = static_cast<obj *>(ptr);
|
obj *node = static_cast<obj *>(ptr);
|
||||||
node->next = free_list[index];
|
node->next = free_list[index];
|
||||||
free_list[index] = node;
|
free_list[index] = node;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
void *alloc::reallocate(void *ptr, size_t old_sz, size_t new_sz){
|
void *alloc::reallocate(void *ptr, size_t old_sz, size_t new_sz){
|
||||||
deallocate(ptr, old_sz);
|
deallocate(ptr, old_sz);
|
||||||
ptr = allocate(new_sz);
|
ptr = allocate(new_sz);
|
||||||
|
|||||||
Reference in New Issue
Block a user