# HG changeset patch # User Matti Hamalainen # Date 1688423078 -10800 # Node ID 4cc514343376420b9815bc0485bf306e07e1e707 # Parent 847d1ebe5b8183924b6e2e1b00ae8bee595e7581 Rename th_cfg_find() to th_cfg_item_find(). diff -r 847d1ebe5b81 -r 4cc514343376 tests.c --- a/tests.c Tue Jul 04 01:22:50 2023 +0300 +++ b/tests.c Tue Jul 04 01:24:38 2023 +0300 @@ -377,22 +377,22 @@ test_ctx ctx; test_start(&ctx, "Test configuration value search #%d", ++nsubtest); - test_result(&ctx, (item = th_cfg_find(cfg, "inside_sect", "intval", -1)) != NULL && *item->v.val_int == 112); + test_result(&ctx, (item = th_cfg_item_find(cfg, "inside_sect", "intval", -1)) != NULL && *item->v.val_int == 112); test_end(&ctx); test_start(&ctx, "Test configuration value search #%d", ++nsubtest); - test_result(&ctx, (item = th_cfg_find(cfg, "another_sect", "boolval", -1)) != NULL && *item->v.val_bool); + test_result(&ctx, (item = th_cfg_item_find(cfg, "another_sect", "boolval", -1)) != NULL && *item->v.val_bool); test_end(&ctx); test_start(&ctx, "Test configuration value search #%d", ++nsubtest); - test_result(&ctx, th_cfg_find(cfg, "no_match", NULL, -1) == NULL); + test_result(&ctx, th_cfg_item_find(cfg, "no_match", NULL, -1) == NULL); test_end(&ctx); test_start(&ctx, "Test configuration value search #%d", ++nsubtest); - test_result(&ctx, th_cfg_find(cfg, NULL, "no_match", -1) == NULL); + test_result(&ctx, th_cfg_item_find(cfg, NULL, "no_match", -1) == NULL); test_end(&ctx); test_start(&ctx, "Test configuration value search #%d", ++nsubtest); - test_result(&ctx, (item = th_cfg_find(cfg, NULL, "hexval", -1)) != NULL && *item->v.val_uint == 0x11223344); + test_result(&ctx, (item = th_cfg_item_find(cfg, NULL, "hexval", -1)) != NULL && *item->v.val_uint == 0x11223344); test_end(&ctx); test_start(&ctx, "Test configuration value search #%d", ++nsubtest); - test_result(&ctx, (item = th_cfg_find(cfg, NULL, "a_string_setting", -1)) != NULL && strcmp(*item->v.val_str, "v_str1") == 0); + test_result(&ctx, (item = th_cfg_item_find(cfg, NULL, "a_string_setting", -1)) != NULL && strcmp(*item->v.val_str, "v_str1") == 0); test_end(&ctx); } @@ -465,7 +465,7 @@ test_config_values(cfg); // Additional tests - item = th_cfg_find(cfg, NULL, "string_list", -1); + item = th_cfg_item_find(cfg, NULL, "string_list", -1); test_result(&ctx, item != NULL); if (item != NULL) { @@ -544,7 +544,7 @@ // Test ptr test_start(&ctx, "Test configuration string list ptr"); test_result(&ctx, - (item = th_cfg_find(cfg, NULL, "string_list", -1)) != NULL && + (item = th_cfg_item_find(cfg, NULL, "string_list", -1)) != NULL && item->v.list == &v_str_list); test_end(&ctx); diff -r 847d1ebe5b81 -r 4cc514343376 th_config.c --- a/th_config.c Tue Jul 04 01:22:50 2023 +0300 +++ b/th_config.c Tue Jul 04 01:24:38 2023 +0300 @@ -991,7 +991,8 @@ } -th_cfgitem_t *th_cfg_find(th_cfgitem_t *cfg, const char *section, const char *name, const int type) +th_cfgitem_t *th_cfg_item_find(th_cfgitem_t *cfg, const char *section, + const char *name, const int type) { th_cfgitem_t *node; diff -r 847d1ebe5b81 -r 4cc514343376 th_config.h --- a/th_config.h Tue Jul 04 01:22:50 2023 +0300 +++ b/th_config.h Tue Jul 04 01:24:38 2023 +0300 @@ -68,6 +68,7 @@ int th_cfg_add_comment(th_cfgitem_t **cfg, const char *comment); int th_cfg_add_section(th_cfgitem_t **cfg, const char *name, th_cfgitem_t *sect); +th_cfgitem_t * th_cfg_item_find(th_cfgitem_t *cfg, const char *section, const char *name, const int type); int th_cfg_add_int(th_cfgitem_t **cfg, const char *name, int *data, int defValue); int th_cfg_add_uint(th_cfgitem_t **cfg, const char *name, unsigned int *data, unsigned int defValue); @@ -78,7 +79,6 @@ int th_cfg_add_hex_triplet(th_cfgitem_t **cfg, const char *name, unsigned int *data, unsigned int defValue); int th_cfg_add_string_list(th_cfgitem_t **cfg, const char *name, th_llist_t **list); -th_cfgitem_t *th_cfg_find(th_cfgitem_t *cfg, const char *section, const char *name, const int type); #ifdef __cplusplus }