diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2023-01-02 16:54:53 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-01-02 16:54:53 +0000 |
commit | dc4daa3a3915fba11ac87d27977240d9a5e0d47d (patch) | |
tree | 7c28de30cdf3c6a351bd41795612be078f451c9f /src/buffer.c | |
parent | a2942c74683be3f67c6044c2886dc6c237358b3d (diff) |
patch 9.0.1132: code is indented more than neededv9.0.1132
Problem: Code is indented more than needed.
Solution: Use an early return to reduce indentation. (Yegappan Lakshmanan,
closes #11769)
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/buffer.c b/src/buffer.c index 7e4772921a..9856898789 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -146,19 +146,19 @@ read_buffer( void buffer_ensure_loaded(buf_T *buf) { - if (buf->b_ml.ml_mfp == NULL) - { - aco_save_T aco; + if (buf->b_ml.ml_mfp != NULL) + return; - // Make sure the buffer is in a window. If not then skip it. - aucmd_prepbuf(&aco, buf); - if (curbuf == buf) - { - if (swap_exists_action != SEA_READONLY) - swap_exists_action = SEA_NONE; - open_buffer(FALSE, NULL, 0); - aucmd_restbuf(&aco); - } + aco_save_T aco; + + // Make sure the buffer is in a window. If not then skip it. + aucmd_prepbuf(&aco, buf); + if (curbuf == buf) + { + if (swap_exists_action != SEA_READONLY) + swap_exists_action = SEA_NONE; + open_buffer(FALSE, NULL, 0); + aucmd_restbuf(&aco); } } #endif @@ -3582,18 +3582,18 @@ buf_set_name(int fnum, char_u *name) buf_T *buf; buf = buflist_findnr(fnum); - if (buf != NULL) - { - if (buf->b_sfname != buf->b_ffname) - vim_free(buf->b_sfname); - vim_free(buf->b_ffname); - buf->b_ffname = vim_strsave(name); - buf->b_sfname = NULL; - // Allocate ffname and expand into full path. Also resolves .lnk - // files on Win32. - fname_expand(buf, &buf->b_ffname, &buf->b_sfname); - buf->b_fname = buf->b_sfname; - } + if (buf == NULL) + return; + + if (buf->b_sfname != buf->b_ffname) + vim_free(buf->b_sfname); + vim_free(buf->b_ffname); + buf->b_ffname = vim_strsave(name); + buf->b_sfname = NULL; + // Allocate ffname and expand into full path. Also resolves .lnk + // files on Win32. + fname_expand(buf, &buf->b_ffname, &buf->b_sfname); + buf->b_fname = buf->b_sfname; } /* @@ -5921,14 +5921,14 @@ buf_get_fname(buf_T *buf) void set_buflisted(int on) { - if (on != curbuf->b_p_bl) - { - curbuf->b_p_bl = on; - if (on) - apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, curbuf); - else - apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf); - } + if (on == curbuf->b_p_bl) + return; + + curbuf->b_p_bl = on; + if (on) + apply_autocmds(EVENT_BUFADD, NULL, NULL, FALSE, curbuf); + else + apply_autocmds(EVENT_BUFDELETE, NULL, NULL, FALSE, curbuf); } /* |