| 96 | | /* Test first allocation */ |
| 97 | | ptr = pj_pool_alloc(pool, 1); |
| 98 | | if (!IS_ALIGNED(ptr)) { |
| 99 | | pj_pool_release(pool); |
| 100 | | return -310; |
| 101 | | } |
| 102 | | |
| 103 | | /* Test subsequent allocation */ |
| 104 | | ptr = pj_pool_alloc(pool, 1); |
| 105 | | if (!IS_ALIGNED(ptr)) { |
| 106 | | pj_pool_release(pool); |
| 107 | | return -320; |
| 108 | | } |
| 109 | | |
| 110 | | /* Test allocation after new block is created */ |
| 111 | | ptr = pj_pool_alloc(pool, 127); |
| 112 | | if (!IS_ALIGNED(ptr)) { |
| 113 | | pj_pool_release(pool); |
| 114 | | return -330; |
| 115 | | } |
| 116 | | |
| 117 | | /* Reset the pool */ |
| 118 | | pj_pool_reset(pool); |
| 119 | | |
| 120 | | /* Retest first allocation */ |
| 121 | | ptr = pj_pool_alloc(pool, 1); |
| 122 | | if (!IS_ALIGNED(ptr)) { |
| 123 | | pj_pool_release(pool); |
| 124 | | return -340; |
| 125 | | } |
| 126 | | |
| 127 | | /* Retest subsequent allocation */ |
| 128 | | ptr = pj_pool_alloc(pool, 1); |
| 129 | | if (!IS_ALIGNED(ptr)) { |
| 130 | | pj_pool_release(pool); |
| 131 | | return -350; |
| | 98 | for (i=0; i<LOOP; ++i) { |
| | 99 | /* Test first allocation */ |
| | 100 | ptr = pj_pool_alloc(pool, 1); |
| | 101 | if (!IS_ALIGNED(ptr)) { |
| | 102 | pj_pool_release(pool); |
| | 103 | return -310; |
| | 104 | } |
| | 105 | |
| | 106 | /* Test subsequent allocation */ |
| | 107 | ptr = pj_pool_alloc(pool, 1); |
| | 108 | if (!IS_ALIGNED(ptr)) { |
| | 109 | pj_pool_release(pool); |
| | 110 | return -320; |
| | 111 | } |
| | 112 | |
| | 113 | /* Test allocation after new block is created */ |
| | 114 | ptr = pj_pool_alloc(pool, MEMSIZE*2+1); |
| | 115 | if (!IS_ALIGNED(ptr)) { |
| | 116 | pj_pool_release(pool); |
| | 117 | return -330; |
| | 118 | } |
| | 119 | |
| | 120 | /* Reset the pool */ |
| | 121 | pj_pool_reset(pool); |
| 153 | | /* Test first allocation */ |
| 154 | | ptr = pj_pool_alloc(pool, 1); |
| 155 | | if (!IS_ALIGNED(ptr)) { |
| 156 | | pj_pool_release(pool); |
| 157 | | return -410; |
| 158 | | } |
| 159 | | |
| 160 | | /* Test subsequent allocation */ |
| 161 | | ptr = pj_pool_alloc(pool, 1); |
| 162 | | if (!IS_ALIGNED(ptr)) { |
| 163 | | pj_pool_release(pool); |
| 164 | | return -420; |
| 165 | | } |
| 166 | | |
| 167 | | /* Reset the pool */ |
| 168 | | pj_pool_reset(pool); |
| 169 | | |
| 170 | | /* Retest first allocation */ |
| 171 | | ptr = pj_pool_alloc(pool, 1); |
| 172 | | if (!IS_ALIGNED(ptr)) { |
| 173 | | pj_pool_release(pool); |
| 174 | | return -430; |
| 175 | | } |
| 176 | | |
| 177 | | /* Retest subsequent allocation */ |
| 178 | | ptr = pj_pool_alloc(pool, 1); |
| 179 | | if (!IS_ALIGNED(ptr)) { |
| 180 | | pj_pool_release(pool); |
| 181 | | return -440; |
| | 145 | for (i=0; i<LOOP; ++i) { |
| | 146 | /* Test first allocation */ |
| | 147 | ptr = pj_pool_alloc(pool, 1); |
| | 148 | if (!IS_ALIGNED(ptr)) { |
| | 149 | pj_pool_release(pool); |
| | 150 | return -410; |
| | 151 | } |
| | 152 | |
| | 153 | /* Test subsequent allocation */ |
| | 154 | ptr = pj_pool_alloc(pool, 1); |
| | 155 | if (!IS_ALIGNED(ptr)) { |
| | 156 | pj_pool_release(pool); |
| | 157 | return -420; |
| | 158 | } |
| | 159 | |
| | 160 | /* Reset the pool */ |
| | 161 | pj_pool_reset(pool); |