Order paths by directory, then name: a directory's files are contiguous. */
| 724 | |
| 725 | /* Order paths by directory, then name: a directory's files are contiguous. */ |
| 726 | static 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 | |
| 741 | static bool tf_same_dir(const char *p, const char *q) { |
| 742 | const char *ps = strrchr(p, '/'); |
nothing calls this directly
no outgoing calls
no test coverage detected