pike.git / src / block_allocator.c

version» Context lines:

pike.git/src/block_allocator.c:14: Inside #if defined(PIKE_DEBUG)
     #ifdef PIKE_DEBUG   static void print_allocator(const struct block_allocator * a);   #endif      #ifdef PIKE_DEBUG   static void ba_check_ptr(struct block_allocator * a, int page, void * ptr, struct ba_block_header *loc,    int ln);   #endif    - static INLINE unsigned INT32 ba_block_number(const struct ba_layout * l, const struct ba_page * p, + static inline unsigned INT32 ba_block_number(const struct ba_layout * l, const struct ba_page * p,    const void * ptr) {    return ((char*)ptr - (char*)BA_BLOCKN(*l, p, 0)) / l->block_size;   }    - static INLINE void ba_dec_layout(struct ba_layout * l, int i) { + static inline void ba_dec_layout(struct ba_layout * l, int i) {    l->blocks >>= i;    l->offset += l->block_size;    l->offset >>= i;    l->offset -= l->block_size;   }    - static INLINE void ba_inc_layout(struct ba_layout * l, int i) { + static inline void ba_inc_layout(struct ba_layout * l, int i) {    l->blocks <<= i;    l->offset += l->block_size;    l->offset <<= i;    l->offset -= l->block_size;   }    - static INLINE void ba_double_layout(struct ba_layout * l) { + static inline void ba_double_layout(struct ba_layout * l) {    ba_inc_layout(l, 1);   }    - static INLINE void ba_half_layout(struct ba_layout * l) { + static inline void ba_half_layout(struct ba_layout * l) {    ba_dec_layout(l, 1);   }    - static INLINE struct ba_layout ba_get_layout(const struct block_allocator * a, int i) { + static inline struct ba_layout ba_get_layout(const struct block_allocator * a, int i) {    struct ba_layout l = a->l;    ba_inc_layout(&l, i);    return l;   }      struct ba_block_header {    struct ba_block_header * next;   };    - static INLINE void ba_clear_page(struct block_allocator * VALGRINDUSED(a), struct ba_page * p, struct ba_layout * l) { + static inline void ba_clear_page(struct block_allocator * VALGRINDUSED(a), struct ba_page * p, struct ba_layout * l) {    p->h.used = 0;    p->h.flags = BA_FLAG_SORTED;    p->h.first = BA_BLOCKN(*l, p, 0);    PIKE_MEMPOOL_ALLOC(a, p->h.first, l->block_size);    p->h.first->next = BA_ONE;    PIKE_MEMPOOL_FREE(a, p->h.first, l->block_size);   }      static struct ba_page * ba_alloc_page(struct block_allocator * a, int i) {    struct ba_layout l = ba_get_layout(a, i);
pike.git/src/block_allocator.c:393:   typedef unsigned INT32 bv_int_t;   #endif      #define BV_WIDTH (BV_LENGTH/8)      struct bitvector {    size_t length;    bv_int_t * v;   };    - static INLINE void bv_set_vector(struct bitvector * bv, void * p) { + static inline void bv_set_vector(struct bitvector * bv, void * p) {    bv->v = (bv_int_t*)p;   }    - static INLINE size_t bv_byte_length(struct bitvector * bv) { + static inline size_t bv_byte_length(struct bitvector * bv) {    size_t bytes = ((bv->length + 7) / 8);       return PIKE_ALIGNTO(bytes, BV_WIDTH);   }    - static INLINE void bv_set(struct bitvector * bv, size_t n, int value) { + static inline void bv_set(struct bitvector * bv, size_t n, int value) {    size_t bit = n % BV_LENGTH;    size_t c = n / BV_LENGTH;    bv_int_t * _v = bv->v + c;    if (value) *_v |= BV_ONE << bit;    else *_v &= ~(BV_ONE << bit);   }    - static INLINE int bv_get(struct bitvector * bv, size_t n) { + static inline int bv_get(struct bitvector * bv, size_t n) {    size_t bit = n % BV_LENGTH;    size_t c = n / BV_LENGTH;    return !!(bv->v[c] & (BV_ONE << bit));   }      static size_t bv_ctz(struct bitvector * bv, size_t n) {    size_t bit;    size_t c;    bv_int_t * _v;    bv_int_t V;