From 1cfb14aa972ccf3235ac67f07b7db1175b7c5384 Mon Sep 17 00:00:00 2001 From: Yegappan Lakshmanan Date: Mon, 9 Jan 2023 19:04:23 +0000 Subject: patch 9.0.1166: code is indented more than necessary Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes #11792) --- src/filepath.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/filepath.c') 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; } -- cgit v1.2.3