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

Function yaml_parent_directory

src/cli/config_yaml_edit.c:784–801  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

782
783#ifndef _WIN32
784static char *yaml_parent_directory(const char *path) {
785 const char *separator = strrchr(path, '/');
786 if (!separator) {
787 char *current = (char *)malloc(YAML_LITERAL_LEN(".") + YAML_UNIT);
788 if (current) {
789 memcpy(current, ".", YAML_LITERAL_LEN(".") + YAML_UNIT);
790 }
791 return current;
792 }
793 size_t len = separator == path ? YAML_UNIT : (size_t)(separator - path);
794 char *parent = (char *)malloc(len + YAML_UNIT);
795 if (!parent) {
796 return NULL;
797 }
798 memcpy(parent, path, len);
799 parent[len] = '\0';
800 return parent;
801}
802#endif
803
804static int yaml_snapshot_matches_path(const char *path, const char *expected_data,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected