}
struct mem_block *
-mmInit(unsigned int ofs, int size)
+mmInit(unsigned ofs, unsigned size)
{
struct mem_block *heap, *block;
- if (size <= 0)
+ if (!size)
return NULL;
heap = (struct mem_block *) _mesa_calloc(sizeof(struct mem_block));
static struct mem_block *
SliceBlock(struct mem_block *p,
- unsigned int startofs, int size,
- int reserved, int alignment)
+ unsigned startofs, unsigned size,
+ unsigned reserved, unsigned alignment)
{
struct mem_block *newblock;
struct mem_block *
-mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
+mmAllocMem(struct mem_block *heap, unsigned size, unsigned align2, unsigned startSearch)
{
struct mem_block *p;
- const int mask = (1 << align2)-1;
- int startofs = 0;
- int endofs;
+ const unsigned mask = (1 << align2)-1;
+ unsigned startofs = 0;
+ unsigned endofs;
- if (!heap || align2 < 0 || size <= 0)
+ if (!heap || !align2 || !size)
return NULL;
for (p = heap->next_free; p != heap; p = p->next_free) {
struct mem_block *
-mmFindBlock(struct mem_block *heap, int start)
+mmFindBlock(struct mem_block *heap, unsigned start)
{
struct mem_block *p;
struct mem_block *next, *prev;
struct mem_block *next_free, *prev_free;
struct mem_block *heap;
- unsigned int ofs;
- int size;
- unsigned int free:1;
- unsigned int reserved:1;
+ unsigned ofs;
+ unsigned size;
+ unsigned free:1;
+ unsigned reserved:1;
};
* input: total size in bytes
* return: a heap pointer if OK, NULL if error
*/
-extern struct mem_block *mmInit(unsigned int ofs, int size);
+extern struct mem_block *mmInit(unsigned ofs, unsigned size);
/**
* Allocate 'size' bytes with 2^align2 bytes alignment,
* startSearch = linear offset from start of heap to begin search
* return: pointer to the allocated block, 0 if error
*/
-extern struct mem_block *mmAllocMem(struct mem_block *heap, int size, int align2,
- int startSearch);
+extern struct mem_block *mmAllocMem(struct mem_block *heap, unsigned size,
+ unsigned align2, unsigned startSearch);
/**
* Free block starts at offset
* input: pointer to a heap, start offset
* return: pointer to a block
*/
-extern struct mem_block *mmFindBlock(struct mem_block *heap, int start);
+extern struct mem_block *mmFindBlock(struct mem_block *heap, unsigned start);
/**
* destroy MM