Check if any CONFIGURES edge has given strategy AND confidence. */
| 47 | |
| 48 | /* Check if any CONFIGURES edge has given strategy AND confidence. */ |
| 49 | static bool has_strategy_with_confidence(const cbm_gbuf_edge_t **edges, int count, |
| 50 | const char *strategy, double confidence) { |
| 51 | char strat_needle[64]; |
| 52 | snprintf(strat_needle, sizeof(strat_needle), "\"strategy\":\"%s\"", strategy); |
| 53 | char conf_needle[64]; |
| 54 | snprintf(conf_needle, sizeof(conf_needle), "\"confidence\":%.2f", confidence); |
| 55 | |
| 56 | for (int i = 0; i < count; i++) { |
| 57 | if (edges[i]->properties_json && strstr(edges[i]->properties_json, strat_needle) && |
| 58 | strstr(edges[i]->properties_json, conf_needle)) |
| 59 | return true; |
| 60 | } |
| 61 | return false; |
| 62 | } |
| 63 | |
| 64 | /* Check if any CONFIGURES edge has given strategy AND config_key. */ |
| 65 | static bool has_strategy_with_key(const cbm_gbuf_edge_t **edges, int count, const char *strategy, |