pike.git / src / block_allocator.c

version» Context lines:

pike.git/src/block_allocator.c:120:    size_t c = 0;    unsigned int i;    for (i = 0; i < a->size; i++) {    c += a->pages[i]->h.used;    }       return c;   }      PMOD_EXPORT void ba_count_all(const struct block_allocator * a, size_t * num, size_t * size) { -  if (a->size) { -  size_t n = (a->l.blocks << (a->size-1)) - a->l.blocks; +  size_t n = 0, b = sizeof( struct block_allocator ); +  unsigned int i; +  for( i=0; i<a->size; i++ ) +  { +  struct ba_layout l = ba_get_layout( a, i ); +  b += l.offset + l.block_size + l.doffset; +  n += a->pages[i]->h.used; +  }    *num = n; -  *size = a->l.block_size * n; -  } else { -  *num = *size = 0; +  *size = b;   } - } +       static void ba_low_alloc(struct block_allocator * a) {    if (a->l.offset) {    unsigned int i;       for (i = 1; i <= a->size; i++) {    struct ba_page * p = a->pages[a->size - i];       if (p->h.first) {    a->alloc = a->size - i;