Mercurial > hg > th-libs
comparison tests.c @ 650:24cbab6e88c6
Remove th_io_free(), merge the functionality to th_io_close(). Add flags
allocation for certain elements and/of the th_ioctx structure itself.
Add helper function th_io_init_stdio(th_ioctx *ctx, FILE *fh) for
initializing th_ioctx with stdio fops and given file handle.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 25 Jan 2020 13:05:11 +0200 |
parents | 2c9260f5cf44 |
children | 18fe45e61b2b |
comparison
equal
deleted
inserted
replaced
649:2c9260f5cf44 | 650:24cbab6e88c6 |
---|---|
472 th_llist_free_func_node(*plist, test_config_free); | 472 th_llist_free_func_node(*plist, test_config_free); |
473 *plist = NULL; | 473 *plist = NULL; |
474 } | 474 } |
475 | 475 |
476 out: | 476 out: |
477 th_io_free(fh); | 477 th_io_close(fh); |
478 } | 478 } |
479 | 479 |
480 | 480 |
481 void test_config(void) | 481 void test_config(void) |
482 { | 482 { |
542 } | 542 } |
543 | 543 |
544 th_io_set_handlers(fh, test_ioctx_error, test_ioctx_msg); | 544 th_io_set_handlers(fh, test_ioctx_error, test_ioctx_msg); |
545 | 545 |
546 th_cfg_write(fh, cfg); | 546 th_cfg_write(fh, cfg); |
547 th_io_free(fh); | 547 th_io_close(fh); |
548 fh = NULL; | 548 fh = NULL; |
549 | 549 |
550 // Test against written configuration file | 550 // Test against written configuration file |
551 test_config_read(cfg, filename); | 551 test_config_read(cfg, filename); |
552 | 552 |
553 // Test against manually edited configuration file | 553 // Test against manually edited configuration file |
554 test_config_read(cfg, "cfg.test01"); | 554 test_config_read(cfg, "cfg.test01"); |
555 | 555 |
556 out: | 556 out: |
557 // Free the data for v_str_list | 557 // Free the data for v_str_list |
558 th_io_free(fh); | 558 th_io_close(fh); |
559 th_llist_free_func_node(v_str_list, test_config_free); | 559 th_llist_free_func_node(v_str_list, test_config_free); |
560 v_str_list = NULL; | 560 v_str_list = NULL; |
561 } | 561 } |
562 | 562 |
563 | 563 |