| 7554 | } |
| 7555 | |
| 7556 | bool cbm_config_load_index_policy(cbm_config_t *cfg, cbm_index_resource_policy_t *policy, |
| 7557 | char *error, size_t error_size) { |
| 7558 | if (!cfg || !policy) { |
| 7559 | if (error && error_size > 0) { |
| 7560 | (void)snprintf(error, error_size, "index resource configuration is unavailable"); |
| 7561 | } |
| 7562 | return false; |
| 7563 | } |
| 7564 | cbm_index_policy_init(policy); |
| 7565 | for (size_t index = 0; index < cbm_index_policy_key_count(); index++) { |
| 7566 | const char *key = cbm_index_policy_key_at(index); |
| 7567 | const char *value = cbm_config_get(cfg, key, cbm_index_policy_default_value(key)); |
| 7568 | if (!cbm_index_policy_set(policy, key, value, error, error_size)) { |
| 7569 | return false; |
| 7570 | } |
| 7571 | } |
| 7572 | return true; |
| 7573 | } |
| 7574 | |
| 7575 | /* ── Config CLI subcommand ────────────────────────────────────── */ |
| 7576 |
no test coverage detected