Refactor small_size2bin and small_bin2size.

Refactor small_size2bin and small_bin2size to be inline functions rather
than directly accessed arrays.
This commit is contained in:
Jason Evans
2014-04-16 17:14:33 -07:00
parent 0b49403958
commit 3541a904d6
5 changed files with 61 additions and 29 deletions

View File

@@ -263,10 +263,10 @@ tcache_alloc_small(tcache_t *tcache, size_t size, bool zero)
size_t binind;
tcache_bin_t *tbin;
binind = SMALL_SIZE2BIN(size);
binind = small_size2bin(size);
assert(binind < NBINS);
tbin = &tcache->tbins[binind];
size = small_bin2size[binind];
size = small_bin2size(binind);
ret = tcache_alloc_easy(tbin);
if (ret == NULL) {
ret = tcache_alloc_small_hard(tcache, tbin, binind);