summaryrefslogtreecommitdiffstats
path: root/src/findfile.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2023-01-09 19:04:23 +0000
committerBram Moolenaar <Bram@vim.org>2023-01-09 19:04:23 +0000
commit1cfb14aa972ccf3235ac67f07b7db1175b7c5384 (patch)
treeb746eda548993b9e0987d7c9c0c543ddddc5758f /src/findfile.c
parent765d82a657c5e42d5d7c88ae410e53f398c34c43 (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/findfile.c')
-rw-r--r--src/findfile.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/findfile.c b/src/findfile.c
index 017e1c6629..ea07a89ed7 100644
--- a/src/findfile.c
+++ b/src/findfile.c
@@ -1345,33 +1345,32 @@ ff_check_visited(
* New file/dir. Add it to the list of visited files/dirs.
*/
vp = alloc(sizeof(ff_visited_T) + STRLEN(ff_expand_buffer));
+ if (vp == NULL)
+ return OK;
- if (vp != NULL)
- {
#ifdef UNIX
- if (!url)
- {
- vp->ffv_dev_valid = TRUE;
- vp->ffv_ino = st.st_ino;
- vp->ffv_dev = st.st_dev;
- vp->ffv_fname[0] = NUL;
- }
- else
- {
- vp->ffv_dev_valid = FALSE;
+ if (!url)
+ {
+ vp->ffv_dev_valid = TRUE;
+ vp->ffv_ino = st.st_ino;
+ vp->ffv_dev = st.st_dev;
+ vp->ffv_fname[0] = NUL;
+ }
+ else
+ {
+ vp->ffv_dev_valid = FALSE;
#endif
- STRCPY(vp->ffv_fname, ff_expand_buffer);
+ STRCPY(vp->ffv_fname, ff_expand_buffer);
#ifdef UNIX
- }
+ }
#endif
- if (wc_path != NULL)
- vp->ffv_wc_path = vim_strsave(wc_path);
- else
- vp->ffv_wc_path = NULL;
+ if (wc_path != NULL)
+ vp->ffv_wc_path = vim_strsave(wc_path);
+ else
+ vp->ffv_wc_path = NULL;
- vp->ffv_next = *visited_list;
- *visited_list = vp;
- }
+ vp->ffv_next = *visited_list;
+ *visited_list = vp;
return OK;
}