Daniil Dagaev P32141
6 unresolved threads
Привет, можно я сделаю ревью? Мне нужно для получения зачета.
Edited by Андрей Попов
- Last updated by Даниил Дагаев
39 39 40 40 /* аллоцировать регион памяти и инициализировать его блоком */ 41 41 static struct region alloc_region ( void const * addr, size_t query ) { 42 /* ??? */ 42 size_t size = region_actual_size(size_from_capacity((block_capacity){query}).bytes); 43 void* region_addr = map_pages(addr, region_actual_size(size),MAP_FIXED_NOREPLACE); 44 region_addr = region_addr == MAP_FAILED ? map_pages(addr, region_actual_size(size), 0) : region_addr; 45 if(region_addr == MAP_FAILED){ 46 return REGION_INVALID; 47 } 48 bool extend = region_addr ==addr; 49 struct region reg ={.addr = region_addr, .extends = extend, .size= region_actual_size(size)}; 50 block_init(reg.addr, (block_size){.bytes = reg.size}, NULL); 51 return reg; 43 52 } changed this line in version 4 of the diff
- Last updated by Даниил Дагаев
60 69 } 61 70 62 71 static bool split_if_too_big( struct block_header* block, size_t query ) { 63 /* ??? */ 72 if(!block_splittable(block,query)){ 73 return false; 74 } 75 block_capacity capacity_b = ( block_capacity){ query }; 76 void* new_block = block->contents + query; 77 block_init(new_block, (block_size) {block->capacity.bytes - capacity_b.bytes}, block-> next); 78 block->capacity = capacity_b; 79 block->next = new_block; 80 return true; 64 81 } changed this line in version 4 of the diff
- Last updated by Даниил Дагаев
80 97 } 81 98 82 99 static bool try_merge_with_next( struct block_header* block ) { 83 /* ??? */ 100 struct block_header* second_block = block->next; 101 if(second_block == NULL || !mergeable(block, block->next)) { 102 return false; 103 } 104 block->capacity.bytes += size_from_capacity(second_block->capacity).bytes; 105 block->next = second_block->next; 106 return true; 84 107 } changed this line in version 4 of the diff
- Last updated by Даниил Дагаев
93 116 94 117 95 118 static struct block_search_result find_good_or_last ( struct block_header* restrict block, size_t sz ) { 96 /*??? */ 119 struct block_search_result find_block = {.block = block, .type = BSR_CORRUPTED}; 120 if(!block) return find_block; 121 else{ changed this line in version 4 of the diff
- Last updated by Даниил Дагаев
150 } 151 152 return res; 103 153 } 104 154 105 155 106 156 107 157 static struct block_header* grow_heap( struct block_header* restrict last, size_t query ) { 108 /* ??? */ 158 if(last ==NULL){ 159 return NULL; 160 } 161 struct region reg = alloc_region(block_after(last), query); 162 if(region_is_invalid(®)){ 163 return NULL; 164 } else{ changed this line in version 4 of the diff
@andrew я сделал ревью
@DaniilDagaev сделал ревью, глянь плиз