buffer: fix void return to grow + add clear() method

This commit is contained in:
Mathieu Virbel 2011-02-06 19:28:11 +01:00
parent 0f5f408f2b
commit 486a0be44d
2 changed files with 10 additions and 3 deletions

View File

@ -5,7 +5,8 @@ cdef class Buffer:
cdef int block_count
cdef int need_pack
cdef grow(self, int block_count)
cdef void clear(self)
cdef void grow(self, int block_count)
cdef void add(self, void *blocks, int *indices, int count)
cdef void remove(self, int *indices, int count)
cdef void pack(self)
@ -14,4 +15,4 @@ cdef class Buffer:
cdef void *pointer(self)
cdef void *offset_pointer(self, int offset)
cdef void update(self, int index, void* blocks, int count)

View File

@ -24,7 +24,7 @@ cdef class Buffer:
self.block_size = block_size
cdef grow(self, int block_count):
cdef void grow(self, int block_count):
'''Automaticly realloc the memory if they are no enough block.
Work only for "grow" operation, not the inverse.
'''
@ -54,6 +54,12 @@ cdef class Buffer:
self.block_count = block_count
cdef void clear(self):
'''Clear the whole buffer, and mark all blocks as available.
'''
self.l_free = range(self.block_count)
cdef void add(self, void *blocks, int *indices, int count):
'''Add a list of block inside our buffer
'''