comparison src/filepath.c @ 18251:c8a53c0daeed v8.1.2120

patch 8.1.2120: some MB_ macros are more complicated than necessary Commit: https://github.com/vim/vim/commit/1614a14901558ca091329315d14a7d5e1b53aa47 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 6 22:00:13 2019 +0200 patch 8.1.2120: some MB_ macros are more complicated than necessary Problem: Some MB_ macros are more complicated than necessary. (Dominique Pelle) Solution: Simplify the macros. Expand inline.
author Bram Moolenaar <Bram@vim.org>
date Sun, 06 Oct 2019 22:15:04 +0200
parents d1e77015f60b
children 8d09b7f53c71
comparison
equal deleted inserted replaced
18250:f1d9d3f76c98 18251:c8a53c0daeed
2611 if (cx == NUL || cy == NUL 2611 if (cx == NUL || cy == NUL
2612 || ((p_fic ? MB_TOLOWER(cx) != MB_TOLOWER(cy) : cx != cy) 2612 || ((p_fic ? MB_TOLOWER(cx) != MB_TOLOWER(cy) : cx != cy)
2613 && !(cx == '/' && cy == '\\') 2613 && !(cx == '/' && cy == '\\')
2614 && !(cx == '\\' && cy == '/'))) 2614 && !(cx == '\\' && cy == '/')))
2615 break; 2615 break;
2616 len -= MB_PTR2LEN(px); 2616 len -= mb_ptr2len(px);
2617 px += MB_PTR2LEN(px); 2617 px += mb_ptr2len(px);
2618 py += MB_PTR2LEN(py); 2618 py += mb_ptr2len(py);
2619 } 2619 }
2620 if (len == 0) 2620 if (len == 0)
2621 return 0; 2621 return 0;
2622 return (cx - cy); 2622 return (cx - cy);
2623 #else 2623 #else
3767 return 1; 3767 return 1;
3768 return p_fic ? MB_TOUPPER(c1) - MB_TOUPPER(c2) 3768 return p_fic ? MB_TOUPPER(c1) - MB_TOUPPER(c2)
3769 : c1 - c2; // no match 3769 : c1 - c2; // no match
3770 } 3770 }
3771 3771
3772 i += MB_PTR2LEN((char_u *)p + i); 3772 i += mb_ptr2len((char_u *)p + i);
3773 j += MB_PTR2LEN((char_u *)q + j); 3773 j += mb_ptr2len((char_u *)q + j);
3774 } 3774 }
3775 if (s == NULL) // "i" or "j" ran into "maxlen" 3775 if (s == NULL) // "i" or "j" ran into "maxlen"
3776 return 0; 3776 return 0;
3777 3777
3778 c1 = PTR2CHAR((char_u *)s + i); 3778 c1 = PTR2CHAR((char_u *)s + i);
3779 c2 = PTR2CHAR((char_u *)s + i + MB_PTR2LEN((char_u *)s + i)); 3779 c2 = PTR2CHAR((char_u *)s + i + mb_ptr2len((char_u *)s + i));
3780 // ignore a trailing slash, but not "//" or ":/" 3780 // ignore a trailing slash, but not "//" or ":/"
3781 if (c2 == NUL 3781 if (c2 == NUL
3782 && i > 0 3782 && i > 0
3783 && !after_pathsep((char_u *)s, (char_u *)s + i) 3783 && !after_pathsep((char_u *)s, (char_u *)s + i)
3784 #ifdef BACKSLASH_IN_FILENAME 3784 #ifdef BACKSLASH_IN_FILENAME