| 409 | } |
| 410 | |
| 411 | void tpl_release(tpl_t *tpl) |
| 412 | { |
| 413 | int i; |
| 414 | |
| 415 | /* Free nodes */ |
| 416 | while (tpl->head != NULL) |
| 417 | { |
| 418 | tpl_node_t *deleted = tpl->head; |
| 419 | tpl->head = tpl->head->next; |
| 420 | destroy_node(deleted); |
| 421 | } |
| 422 | |
| 423 | /* Free any added content */ |
| 424 | while (tpl->added_head != NULL) |
| 425 | { |
| 426 | tpl_node_t *deleted = tpl->added_head; |
| 427 | tpl->added_head = tpl->added_head->next; |
| 428 | destroy_node(deleted); |
| 429 | } |
| 430 | /* Free field cells */ |
| 431 | for (i = 0; i < HASH_TABLE_SIZE; i++) |
| 432 | { |
| 433 | tpl_fcell_t *fc = tpl->fields[i]; |
| 434 | |
| 435 | while (fc != NULL) |
| 436 | { |
| 437 | tpl_fcell_t *deleted = fc; |
| 438 | fc = fc->next; |
| 439 | destroy_fcell(deleted); |
| 440 | } |
| 441 | } |
| 442 | /* Free sections including added content */ |
| 443 | while (tpl->first != NULL) |
| 444 | { |
| 445 | tpl_tcell_t *deleted = tpl->first; |
| 446 | tpl->first = tpl->first->next; |
| 447 | |
| 448 | /* This will call tpl_release() recursively */ |
| 449 | destroy_tcell(deleted); |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | tpl_t* tpl_alloc(void) |
| 454 | { |
no test coverage detected
searching dependent graphs…