X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvppinfra%2Fheap.c;h=b81e1e1339e597632a888a81cde30c5f00dbd738;hb=090096bff365b4ad69c061303c0852bf214b4f03;hp=f7b1f6bb31ec3ec4506f995c6590a21e9bfbcdcc;hpb=b7b929931a07fbb27b43d5cd105f366c3e29807e;p=vpp.git diff --git a/src/vppinfra/heap.c b/src/vppinfra/heap.c index f7b1f6bb31e..b81e1e1339e 100644 --- a/src/vppinfra/heap.c +++ b/src/vppinfra/heap.c @@ -297,6 +297,7 @@ search_free_list (void *v, uword size) /* 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--; @@ -304,12 +305,15 @@ search_free_list (void *v, uword size) 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)); @@ -378,7 +382,7 @@ dealloc_elt (void *v, heap_elt_t * e) combine_free_blocks (v, p, n); } -void * +__clib_export void * _heap_alloc (void *v, uword size, uword align, @@ -492,7 +496,7 @@ error: return v; } -void +__clib_export void heap_dealloc (void *v, uword handle) { heap_header_t *h = heap_header (v); @@ -603,7 +607,7 @@ heap_len (void *v, word handle) return heap_elt_size (v, elt_at (h, handle)); } -void * +__clib_export void * _heap_free (void *v) { heap_header_t *h = heap_header (v);