/* Find an object that is large enough.
Search list in reverse so that more recently freed objects will be
allocated again sooner. */
+ u8 found = 0;
do
{
l--;
f = elt_at (h, f_index);
f_size = heap_elt_size (v, f);
if ((s = f_size - size) >= 0)
- break;
+ {
+ found = 1;
+ break;
+ }
}
while (l > 0);
/* If we fail to find a large enough object, try the next larger size. */
- if (l < 0)
+ if (found == 0)
continue;
ASSERT (heap_is_free (f));
combine_free_blocks (v, p, n);
}
-void *
+__clib_export void *
_heap_alloc (void *v,
uword size,
uword align,
return v;
}
-void
+__clib_export void
heap_dealloc (void *v, uword handle)
{
heap_header_t *h = heap_header (v);
return heap_elt_size (v, elt_at (h, handle));
}
-void *
+__clib_export void *
_heap_free (void *v)
{
heap_header_t *h = heap_header (v);