1 #ifndef _MEM_BLOCK_MGR_H_ 2 #define _MEM_BLOCK_MGR_H_ 20 int found_size = -1,found_index = -1;
21 for(n=0;n<list.get_count();n++)
25 int block_size = list[n]->block.get_size();
28 found_index=n; found_size = block_size;
30 else if (found_size<size)
32 if (block_size>found_size)
34 found_index=n; found_size = block_size;
37 else if (found_size>size)
39 if (block_size>=size && block_size<found_size)
41 found_index=n; found_size = block_size;
45 if (found_size==size)
break;
50 list[found_index]->used =
true;
51 return list[found_index]->block.copy(ptr,size);
54 new_entry->
used =
true;
55 list.add_item(new_entry);
56 return new_entry->
block.copy(ptr,size);
62 for(n=0;n<list.get_count();n++)
64 list[n]->used =
false;
T * copy(const T *ptr, int size)