vim-patch:partial:9.0.1196: code is indented more than necessary (#21796)

Problem:    Code is indented more than necessary.
Solution:   Use an early return where it makes sense. (Yegappan Lakshmanan,
            closes vim/vim#11813)

e857598896

Partial port as this depends on some previous eval and 'smoothscroll'
patches.

Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
This commit is contained in:
zeertzjq
2023-01-14 21:36:15 +08:00
committed by GitHub
parent d549734fb4
commit 2065ce877e
11 changed files with 173 additions and 142 deletions

View File

@@ -653,29 +653,31 @@ fmark_T *getnextmark(pos_T *startpos, int dir, int begin_line)
// until the mark is used to avoid a long startup delay.
static void fname2fnum(xfmark_T *fm)
{
if (fm->fname != NULL) {
// First expand "~/" in the file name to the home directory.
// Don't expand the whole name, it may contain other '~' chars.
if (fm->fname == NULL) {
return;
}
// First expand "~/" in the file name to the home directory.
// Don't expand the whole name, it may contain other '~' chars.
#ifdef BACKSLASH_IN_FILENAME
if (fm->fname[0] == '~' && (fm->fname[1] == '/' || fm->fname[1] == '\\')) {
if (fm->fname[0] == '~' && (fm->fname[1] == '/' || fm->fname[1] == '\\')) {
#else
if (fm->fname[0] == '~' && (fm->fname[1] == '/')) {
if (fm->fname[0] == '~' && (fm->fname[1] == '/')) {
#endif
expand_env("~/", NameBuff, MAXPATHL);
int len = (int)strlen(NameBuff);
xstrlcpy(NameBuff + len, fm->fname + 2, (size_t)(MAXPATHL - len));
} else {
xstrlcpy(NameBuff, fm->fname, MAXPATHL);
}
// Try to shorten the file name.
os_dirname(IObuff, IOSIZE);
char *p = path_shorten_fname(NameBuff, IObuff);
// buflist_new() will call fmarks_check_names()
(void)buflist_new(NameBuff, p, (linenr_T)1, 0);
expand_env("~/", NameBuff, MAXPATHL);
int len = (int)strlen(NameBuff);
xstrlcpy(NameBuff + len, fm->fname + 2, (size_t)(MAXPATHL - len));
} else {
xstrlcpy(NameBuff, fm->fname, MAXPATHL);
}
// Try to shorten the file name.
os_dirname(IObuff, IOSIZE);
char *p = path_shorten_fname(NameBuff, IObuff);
// buflist_new() will call fmarks_check_names()
(void)buflist_new(NameBuff, p, (linenr_T)1, 0);
}
// Check all file marks for a name that matches the file name in buf.