| 782 | |
| 783 | #ifndef _WIN32 |
| 784 | static 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 | |
| 804 | static int yaml_snapshot_matches_path(const char *path, const char *expected_data, |
no outgoing calls
no test coverage detected