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

Function tf_cmp_dir_path

src/pipeline/pass_terraform.c:726–739  ·  view source on GitHub ↗

Order paths by directory, then name: a directory's files are contiguous. */

Source from the content-addressed store, hash-verified

724
725/* Order paths by directory, then name: a directory's files are contiguous. */
726static int tf_cmp_dir_path(const void *x, const void *y) {
727 const char *p = *(const char *const *)x;
728 const char *q = *(const char *const *)y;
729 const char *ps = strrchr(p, '/');
730 const char *qs = strrchr(q, '/');
731 size_t pl = ps ? (size_t)(ps - p) : 0;
732 size_t ql = qs ? (size_t)(qs - q) : 0;
733 size_t n = pl < ql ? pl : ql;
734 int c = strncmp(p, q, n);
735 if (c == 0 && pl != ql) {
736 c = pl < ql ? -1 : 1;
737 }
738 return c ? c : strcmp(p, q);
739}
740
741static bool tf_same_dir(const char *p, const char *q) {
742 const char *ps = strrchr(p, '/');

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected