returns 1 if success, 0 if failure ==> nothing done*/
| 229 | |
| 230 | /*returns 1 if success, 0 if failure ==> nothing done*/ |
| 231 | static unsigned uivector_resize(uivector* p, size_t size) { |
| 232 | size_t allocsize = size * sizeof(unsigned); |
| 233 | if(allocsize > p->allocsize) { |
| 234 | size_t newsize = allocsize + (p->allocsize >> 1u); |
| 235 | void* data = lodepng_realloc(p->data, newsize); |
| 236 | if(data) { |
| 237 | p->allocsize = newsize; |
| 238 | p->data = (unsigned*)data; |
| 239 | } |
| 240 | else return 0; /*error: not enough memory*/ |
| 241 | } |
| 242 | p->size = size; |
| 243 | return 1; /*success*/ |
| 244 | } |
| 245 | |
| 246 | static void uivector_init(uivector* p) { |
| 247 | p->data = NULL; |
no test coverage detected