22 #include "omalloc/omTables.inc"
44 newpage->used_blocks = -1;
46 tmp = newpage->current;
47 while (i < bin->max_blocks)
49 tmp = *((
void**)tmp) = ((
void**) tmp) + bin->sizeW;
52 *((
void**)tmp) =
NULL;
54 (bin->max_blocks > 1 ? bin->max_blocks : 1));
61 if (bin->current_page == page)
63 if (page->next ==
NULL)
65 if (page->prev ==
NULL)
68 bin->last_page =
NULL;
72 bin->current_page = page->prev;
75 bin->current_page = page->next;
77 if (bin->last_page == page)
80 bin->last_page = page->prev;
85 page->next->prev = page->prev;
87 if (page->prev !=
NULL) page->prev->next = page->next;
97 bin->current_page = page;
98 bin->last_page = page;
103 if (after == bin->last_page)
105 bin->last_page = page;
110 after->next->prev = page;
112 page->next = after->next;
131 bin->current_page->used_blocks &= (((
unsigned long) 1) << (
BIT_SIZEOF_LONG -1));
133 bin->current_page->used_blocks = 0;
137 if (!bin->sticky && bin->current_page->next !=
NULL)
140 newpage = bin->current_page->next;
149 bin->current_page = newpage;
151 newpage->current !=
NULL);
173 if (page->used_blocks < 0L)
175 omFreeTrackAddr(addr);
181 if ((page->current !=
NULL) || (bin->max_blocks <= 1))
186 if (bin->max_blocks > 0)
191 om_JustFreedPage = page;
197 page->current = addr;
198 page->used_blocks = bin->max_blocks - 2;
199 *((
void**)addr) =
NULL;
202 #if defined(PAGE_BEFORE_CURRENT)
203 if (bin->current_page->prev !=
NULL)
207 bin->current_page = page;
209 # if defined(PAGE_AFTER_CURRENT)
223 #ifdef OM_ALIGNMNET_NEEDS_WORK
224 #define DO_ZERO(flag) (flag & 1)
226 #define DO_ZERO(flag) flag
229 void*
omDoRealloc(
void* old_addr,
size_t new_size,
int flag)
247 #ifdef OM_ALIGNMENT_NEEDS_WORK
255 min_size = (old_size < new_size ? old_size : new_size);
256 omMemcpyW(new_addr, old_addr, min_size >> LOG_SIZEOF_LONG);
258 if (
DO_ZERO(flag) && (new_size > old_size))
259 omMemsetW((
char*) new_addr + min_size, 0, (new_size - old_size) >> LOG_SIZEOF_LONG);