summaryrefslogtreecommitdiff
path: root/src/misc2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-04 20:59:15 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-04 20:59:15 +0200
commit26262f87770d3a1a68b09a70152d75c2e2ae186f (patch)
treea051b686adb302a8d050a85007aa335787ced0b4 /src/misc2.c
parent3f4f3d8e7e6fc0494d00cfb75669a554c8e67c8b (diff)
downloadvim-git-26262f87770d3a1a68b09a70152d75c2e2ae186f.tar.gz
patch 8.1.1985: code for dealing with paths is spread outv8.1.1985
Problem: Code for dealing with paths is spread out. Solution: Move path related functions from misc1.c to filepath.c. Remove NO_EXPANDPATH.
Diffstat (limited to 'src/misc2.c')
-rw-r--r--src/misc2.c76
1 files changed, 0 insertions, 76 deletions
diff --git a/src/misc2.c b/src/misc2.c
index cf8b5df2f..e0df7c839 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -3938,82 +3938,6 @@ sort_strings(
qsort((void *)files, (size_t)count, sizeof(char_u *), sort_compare);
}
-#if !defined(NO_EXPANDPATH) || defined(PROTO)
-/*
- * Compare path "p[]" to "q[]".
- * If "maxlen" >= 0 compare "p[maxlen]" to "q[maxlen]"
- * Return value like strcmp(p, q), but consider path separators.
- */
- int
-pathcmp(const char *p, const char *q, int maxlen)
-{
- int i, j;
- int c1, c2;
- const char *s = NULL;
-
- for (i = 0, j = 0; maxlen < 0 || (i < maxlen && j < maxlen);)
- {
- c1 = PTR2CHAR((char_u *)p + i);
- c2 = PTR2CHAR((char_u *)q + j);
-
- /* End of "p": check if "q" also ends or just has a slash. */
- if (c1 == NUL)
- {
- if (c2 == NUL) /* full match */
- return 0;
- s = q;
- i = j;
- break;
- }
-
- /* End of "q": check if "p" just has a slash. */
- if (c2 == NUL)
- {
- s = p;
- break;
- }
-
- if ((p_fic ? MB_TOUPPER(c1) != MB_TOUPPER(c2) : c1 != c2)
-#ifdef BACKSLASH_IN_FILENAME
- /* consider '/' and '\\' to be equal */
- && !((c1 == '/' && c2 == '\\')
- || (c1 == '\\' && c2 == '/'))
-#endif
- )
- {
- if (vim_ispathsep(c1))
- return -1;
- if (vim_ispathsep(c2))
- return 1;
- return p_fic ? MB_TOUPPER(c1) - MB_TOUPPER(c2)
- : c1 - c2; /* no match */
- }
-
- i += MB_PTR2LEN((char_u *)p + i);
- j += MB_PTR2LEN((char_u *)q + j);
- }
- if (s == NULL) /* "i" or "j" ran into "maxlen" */
- return 0;
-
- c1 = PTR2CHAR((char_u *)s + i);
- c2 = PTR2CHAR((char_u *)s + i + MB_PTR2LEN((char_u *)s + i));
- /* ignore a trailing slash, but not "//" or ":/" */
- if (c2 == NUL
- && i > 0
- && !after_pathsep((char_u *)s, (char_u *)s + i)
-#ifdef BACKSLASH_IN_FILENAME
- && (c1 == '/' || c1 == '\\')
-#else
- && c1 == '/'
-#endif
- )
- return 0; /* match with trailing slash */
- if (s == q)
- return -1; /* no match */
- return 1;
-}
-#endif
-
/*
* The putenv() implementation below comes from the "screen" program.
* Included with permission from Juergen Weigert.