String argument `key` copied into `buf` (truncated to fit): buf, or NULL * when absent or empty. Nothing to free. */
| 1565 | /* String argument `key` copied into `buf` (truncated to fit): buf, or NULL |
| 1566 | * when absent or empty. Nothing to free. */ |
| 1567 | static const char *mcp_string_arg_buf(const char *args_json, const char *key, char *buf, |
| 1568 | size_t buf_sz) { |
| 1569 | buf[0] = '\0'; |
| 1570 | yyjson_doc *doc = yyjson_read(args_json, strlen(args_json), 0); |
| 1571 | if (!doc) { |
| 1572 | return NULL; |
| 1573 | } |
| 1574 | yyjson_val *val = yyjson_obj_get(yyjson_doc_get_root(doc), key); |
| 1575 | if (val && yyjson_is_str(val)) { |
| 1576 | snprintf(buf, buf_sz, "%s", yyjson_get_str(val)); |
| 1577 | } |
| 1578 | yyjson_doc_free(doc); |
| 1579 | return buf[0] ? buf : NULL; |
| 1580 | } |
| 1581 | |
| 1582 | static char *canonicalize_repo_path_if_exists(char *repo_path) { |
| 1583 | if (!repo_path) { |
no outgoing calls
no test coverage detected