The doc_candidates key of captured worker args: 1 true, 0 false, -1 absent, * -2 not a single boolean (or unparseable args). */
| 15488 | /* The doc_candidates key of captured worker args: 1 true, 0 false, -1 absent, |
| 15489 | * -2 not a single boolean (or unparseable args). */ |
| 15490 | static int doccand_forwarded(const doccand_executor_capture_t *capture) { |
| 15491 | yyjson_doc *doc = capture->args ? yyjson_read(capture->args, strlen(capture->args), 0) : NULL; |
| 15492 | yyjson_val *root = doc ? yyjson_doc_get_root(doc) : NULL; |
| 15493 | if (!root || !yyjson_is_obj(root)) { |
| 15494 | yyjson_doc_free(doc); |
| 15495 | return -2; |
| 15496 | } |
| 15497 | int keys = 0; |
| 15498 | int value = -1; |
| 15499 | size_t idx; |
| 15500 | size_t max; |
| 15501 | yyjson_val *key; |
| 15502 | yyjson_val *val; |
| 15503 | yyjson_obj_foreach(root, idx, max, key, val) { |
| 15504 | if (strcmp(yyjson_get_str(key), "doc_candidates") == 0) { |
| 15505 | keys++; |
| 15506 | value = yyjson_is_bool(val) ? (yyjson_get_bool(val) ? 1 : 0) : -2; |
| 15507 | } |
| 15508 | } |
| 15509 | yyjson_doc_free(doc); |
| 15510 | return keys > 1 ? -2 : value; |
| 15511 | } |
| 15512 | |
| 15513 | static int doccand_forward_call(cbm_mcp_server_t *srv, doccand_executor_capture_t *capture, |
| 15514 | const char *repo, const char *extra) { |
no outgoing calls
no test coverage detected