MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cmm_hook_args_equal

Function cmm_hook_args_equal

src/cli/cli.c:4601–4619  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4599};
4600
4601static bool cmm_hook_args_equal(yyjson_mut_val *hook, const char *const *expected_args,
4602 size_t expected_arg_count) {
4603 yyjson_mut_val *args = yyjson_mut_is_obj(hook) ? yyjson_mut_obj_get(hook, "args") : NULL;
4604 if (expected_arg_count == 0U) {
4605 return args == NULL;
4606 }
4607 if (!expected_args || !args || !yyjson_mut_is_arr(args) ||
4608 yyjson_mut_arr_size(args) != expected_arg_count) {
4609 return false;
4610 }
4611 for (size_t i = 0U; i < expected_arg_count; i++) {
4612 yyjson_mut_val *arg = yyjson_mut_arr_get(args, i);
4613 if (!expected_args[i] || !arg || !yyjson_mut_is_str(arg) ||
4614 strcmp(yyjson_mut_get_str(arg), expected_args[i]) != 0) {
4615 return false;
4616 }
4617 }
4618 return true;
4619}
4620
4621/* Check if a hook array entry is ours (current matcher or a known old one).
4622 * Matcher identity is never sufficient because users commonly choose the same

Callers 1

find_cmm_hook_in_entryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected