| 183 | | if (a) { |
|---|
| 184 | | a->limit = (uword)a + sz; |
|---|
| 185 | | a->base = a->avail = (uword)ARENA_ALIGN(pool, a + 1); |
|---|
| 186 | | rp = (char *)a->avail; |
|---|
| 187 | | a->avail += nb; |
|---|
| 188 | | /* the newly allocated arena is linked after pool->current |
|---|
| 189 | | * and becomes pool->current */ |
|---|
| 190 | | a->next = pool->current->next; |
|---|
| 191 | | pool->current->next = a; |
|---|
| 192 | | pool->current = a; |
|---|
| 193 | | if ( !pool->first.next ) |
|---|
| 194 | | pool->first.next = a; |
|---|
| 195 | | return(rp); |
|---|
| 196 | | } |
|---|
| 197 | | } |
|---|
| 198 | | |
|---|
| 199 | | /* we got to here, and there's no memory to allocate */ |
|---|
| 200 | | return(0); |
|---|
| | 183 | // fastMalloc will abort() if it fails, so we are guaranteed that a is not 0. |
|---|
| | 184 | a->limit = (uword)a + sz; |
|---|
| | 185 | a->base = a->avail = (uword)ARENA_ALIGN(pool, a + 1); |
|---|
| | 186 | rp = (char *)a->avail; |
|---|
| | 187 | a->avail += nb; |
|---|
| | 188 | /* the newly allocated arena is linked after pool->current |
|---|
| | 189 | * and becomes pool->current */ |
|---|
| | 190 | a->next = pool->current->next; |
|---|
| | 191 | pool->current->next = a; |
|---|
| | 192 | pool->current = a; |
|---|
| | 193 | if ( !pool->first.next ) |
|---|
| | 194 | pool->first.next = a; |
|---|
| | 195 | return(rp); |
|---|
| | 196 | } |
|---|