Resize file object and keep memory content */
| 323 | |
| 324 | /* Resize file object and keep memory content */ |
| 325 | static struct fileobject *remalloc_fo(struct fileobject *old, |
| 326 | const size_t size) |
| 327 | { |
| 328 | struct fileobject *fo = old; |
| 329 | |
| 330 | if (!old || !size) |
| 331 | return NULL; |
| 332 | |
| 333 | fo->data = realloc(fo->data, size); |
| 334 | if (!fo->data) |
| 335 | return NULL; |
| 336 | |
| 337 | if (fo->size < size) |
| 338 | memset(&fo->data[fo->size], 0, size - fo->size); |
| 339 | |
| 340 | fo->size = size; |
| 341 | |
| 342 | return fo; |
| 343 | } |
| 344 | |
| 345 | /* |
| 346 | * Creates a new subregion copy of fileobject. |
no test coverage detected