diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2023-01-09 19:04:23 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-01-09 19:04:23 +0000 |
commit | 1cfb14aa972ccf3235ac67f07b7db1175b7c5384 (patch) | |
tree | b746eda548993b9e0987d7c9c0c543ddddc5758f /src/filepath.c | |
parent | 765d82a657c5e42d5d7c88ae410e53f398c34c43 (diff) |
patch 9.0.1166: code is indented more than necessaryv9.0.1166
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes #11792)
Diffstat (limited to 'src/filepath.c')
-rw-r--r-- | src/filepath.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/filepath.c b/src/filepath.c index 023c7322f3..be1a5810ad 100644 --- a/src/filepath.c +++ b/src/filepath.c @@ -3084,13 +3084,13 @@ concat_fnames(char_u *fname1, char_u *fname2, int sep) char_u *dest; dest = alloc(STRLEN(fname1) + STRLEN(fname2) + 3); - if (dest != NULL) - { - STRCPY(dest, fname1); - if (sep) - add_pathsep(dest); - STRCAT(dest, fname2); - } + if (dest == NULL) + return NULL; + + STRCPY(dest, fname1); + if (sep) + add_pathsep(dest); + STRCAT(dest, fname2); return dest; } @@ -3122,14 +3122,14 @@ FullName_save( return NULL; buf = alloc(MAXPATHL); - if (buf != NULL) - { - if (vim_FullName(fname, buf, MAXPATHL, force) != FAIL) - new_fname = vim_strsave(buf); - else - new_fname = vim_strsave(fname); - vim_free(buf); - } + if (buf == NULL) + return NULL; + + if (vim_FullName(fname, buf, MAXPATHL, force) != FAIL) + new_fname = vim_strsave(buf); + else + new_fname = vim_strsave(fname); + vim_free(buf); return new_fname; } |