Lines Matching refs:newblock
102 struct mem_block *newblock;
104 /* break left [p, newblock, p->next], then p = newblock */
106 newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block));
107 if (!newblock)
109 newblock->ofs = startofs;
110 newblock->size = p->size - (startofs - p->ofs);
111 newblock->free = 1;
112 newblock->heap = p->heap;
114 newblock->next = p->next;
115 newblock->prev = p;
116 p->next->prev = newblock;
117 p->next = newblock;
119 newblock->next_free = p->next_free;
120 newblock->prev_free = p;
121 p->next_free->prev_free = newblock;
122 p->next_free = newblock;
124 p->size -= newblock->size;
125 p = newblock;
128 /* break right, also [p, newblock, p->next] */
130 newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block));
131 if (!newblock)
133 newblock->ofs = startofs + size;
134 newblock->size = p->size - size;
135 newblock->free = 1;
136 newblock->heap = p->heap;
138 newblock->next = p->next;
139 newblock->prev = p;
140 p->next->prev = newblock;
141 p->next = newblock;
143 newblock->next_free = p->next_free;
144 newblock->prev_free = p;
145 p->next_free->prev_free = newblock;
146 p->next_free = newblock;