Skip to content

Commit

Permalink
Slab: style.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdocguard committed Jul 4, 2017
1 parent 7570718 commit 75c3f89
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/core/ngx_slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ void *
ngx_slab_alloc_locked(ngx_slab_pool_t *pool, size_t size)
{
size_t s;
uintptr_t p, n, m, mask, *bitmap;
ngx_uint_t i, slot, shift, map;
uintptr_t p, m, mask, *bitmap;
ngx_uint_t i, n, slot, shift, map;
ngx_slab_page_t *page, *prev, *slots;

if (size > ngx_slab_max_size) {
Expand Down Expand Up @@ -226,7 +226,7 @@ ngx_slab_alloc_locked(ngx_slab_pool_t *pool, size_t size)

bitmap = (uintptr_t *) ngx_slab_page_addr(pool, page);

map = (ngx_pagesize >> shift) / (sizeof(uintptr_t) * 8);
map = (ngx_pagesize >> shift) / (8 * sizeof(uintptr_t));

for (n = 0; n < map; n++) {

Expand All @@ -239,7 +239,7 @@ ngx_slab_alloc_locked(ngx_slab_pool_t *pool, size_t size)

bitmap[n] |= m;

i = (n * sizeof(uintptr_t) * 8 + i) << shift;
i = (n * 8 * sizeof(uintptr_t) + i) << shift;

p = (uintptr_t) bitmap + i;

Expand Down Expand Up @@ -341,7 +341,7 @@ ngx_slab_alloc_locked(ngx_slab_pool_t *pool, size_t size)
/* "n" elements for bitmap, plus one requested */
bitmap[0] = ((uintptr_t) 2 << n) - 1;

map = (ngx_pagesize >> shift) / (sizeof(uintptr_t) * 8);
map = (ngx_pagesize >> shift) / (8 * sizeof(uintptr_t));

for (i = 1; i < map; i++) {
bitmap[i] = 0;
Expand Down Expand Up @@ -369,7 +369,7 @@ ngx_slab_alloc_locked(ngx_slab_pool_t *pool, size_t size)

slots[slot].next = page;

pool->stats[slot].total += sizeof(uintptr_t) * 8;
pool->stats[slot].total += 8 * sizeof(uintptr_t);

p = ngx_slab_page_addr(pool, page);

Expand Down Expand Up @@ -480,8 +480,8 @@ ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p)
}

n = ((uintptr_t) p & (ngx_pagesize - 1)) >> shift;
m = (uintptr_t) 1 << (n % (sizeof(uintptr_t) * 8));
n /= sizeof(uintptr_t) * 8;
m = (uintptr_t) 1 << (n % (8 * sizeof(uintptr_t)));
n /= 8 * sizeof(uintptr_t);
bitmap = (uintptr_t *)
((uintptr_t) p & ~((uintptr_t) ngx_pagesize - 1));

Expand Down Expand Up @@ -510,7 +510,7 @@ ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p)
goto done;
}

map = (ngx_pagesize >> shift) / (sizeof(uintptr_t) * 8);
map = (ngx_pagesize >> shift) / (8 * sizeof(uintptr_t));

for (i = 1; i < map; i++) {
if (bitmap[i]) {
Expand Down Expand Up @@ -558,7 +558,7 @@ ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p)

ngx_slab_free_pages(pool, page, 1);

pool->stats[slot].total -= sizeof(uintptr_t) * 8;
pool->stats[slot].total -= 8 * sizeof(uintptr_t);

goto done;
}
Expand Down

0 comments on commit 75c3f89

Please sign in to comment.