/* 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);
+ 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);
set_free_elt (v, elt_at (h, g.index), g.bin_index);
}
-uword
+__clib_export uword
heap_len (void *v, word 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);
return s;
}
-u8 *
-format_heap (u8 * s, va_list * va)
+__clib_export u8 *
+format_heap (u8 *s, va_list *va)
{
void *v = va_arg (*va, void *);
uword verbose = va_arg (*va, uword);
return s;
}
-void
+__clib_export void
heap_validate (void *v)
{
heap_header_t *h = heap_header (v);