pike.git / src / block_allocator.c

version» Context lines:

pike.git/src/block_allocator.c:579: Inside #if defined(BA_DEBUG)
     #ifdef BA_DEBUG    ba_check_allocator(a, "ba_alloc after grow", __FILE__, __LINE__);   #endif       a->first_blk = a->first->first;   }      PMOD_EXPORT void ba_low_free(struct block_allocator * a, ba_page p,    ba_block_header ptr) { +  if (!p) { +  ba_find_page(a, ptr); +  p = a->last_free; +  ((ba_block_header)ptr)->next = p->first; +  p->first = (ba_block_header)ptr; +  p->used--; +  } +     // page was full    if (unlikely(!ptr->next)) {       if (a->first) {    p->prev = a->last;    a->last->next = p;    a->last = p;    p->first = ptr;    } else {    p->prev = p->next = NULL;
pike.git/src/block_allocator.c:610:    p->prev->next = p->next;    p->prev = NULL;    }    a->last_free = NULL;    p->next = a->empty;    a->empty = p;    a->empty_pages ++;    }   }    - PMOD_EXPORT void ba_find_page(struct block_allocator * a, + PMOD_EXPORT INLINE void ba_find_page(struct block_allocator * a,    const void * ptr) {    ba_page_t n;   #ifdef BA_DEBUG    ba_check_allocator(a, "ba_low_free", __FILE__, __LINE__);   #endif   #ifdef BA_HASH_THLD    if (a->num_pages <= BA_HASH_THLD) {    for (n = 0; n < a->num_pages; n++) {    if (BA_CHECK_PTR(a, a->pages[n], ptr)) {    a->last_free = a->pages[n];