diff src/filepath.c @ 19301:80baa37506d0 v8.2.0209

patch 8.2.0209: function a bit far away from where it's used Commit: https://github.com/vim/vim/commit/80147dda4f5a25c9533bc88583c87dbbb0a0f1f1 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 4 22:32:59 2020 +0100 patch 8.2.0209: function a bit far away from where it's used Problem: Function a bit far away from where it's used. Solution: Move function close to where it's used. (Ken Takata, closes https://github.com/vim/vim/issues/5569)
author Bram Moolenaar <Bram@vim.org>
date Tue, 04 Feb 2020 22:45:04 +0100
parents 8b710057093c
children 782f410c5df3
line wrap: on
line diff
--- a/src/filepath.c
+++ b/src/filepath.c
@@ -1256,41 +1256,6 @@ f_isdirectory(typval_T *argvars, typval_
 }
 
 /*
- * Evaluate "expr" (= "context") for readdir().
- */
-    static int
-readdir_checkitem(void *context, char_u *name)
-{
-    typval_T	*expr = (typval_T *)context;
-    typval_T	save_val;
-    typval_T	rettv;
-    typval_T	argv[2];
-    int		retval = 0;
-    int		error = FALSE;
-
-    if (expr->v_type == VAR_UNKNOWN)
-	return 1;
-
-    prepare_vimvar(VV_VAL, &save_val);
-    set_vim_var_string(VV_VAL, name, -1);
-    argv[0].v_type = VAR_STRING;
-    argv[0].vval.v_string = name;
-
-    if (eval_expr_typval(expr, argv, 1, &rettv) == FAIL)
-	goto theend;
-
-    retval = tv_get_number_chk(&rettv, &error);
-    if (error)
-	retval = -1;
-    clear_tv(&rettv);
-
-theend:
-    set_vim_var_string(VV_VAL, NULL, 0);
-    restore_vimvar(VV_VAL, &save_val);
-    return retval;
-}
-
-/*
  * Create the directory in which "dir" is located, and higher levels when
  * needed.
  * Return OK or FAIL.
@@ -1386,6 +1351,41 @@ f_pathshorten(typval_T *argvars, typval_
 }
 
 /*
+ * Evaluate "expr" (= "context") for readdir().
+ */
+    static int
+readdir_checkitem(void *context, char_u *name)
+{
+    typval_T	*expr = (typval_T *)context;
+    typval_T	save_val;
+    typval_T	rettv;
+    typval_T	argv[2];
+    int		retval = 0;
+    int		error = FALSE;
+
+    if (expr->v_type == VAR_UNKNOWN)
+	return 1;
+
+    prepare_vimvar(VV_VAL, &save_val);
+    set_vim_var_string(VV_VAL, name, -1);
+    argv[0].v_type = VAR_STRING;
+    argv[0].vval.v_string = name;
+
+    if (eval_expr_typval(expr, argv, 1, &rettv) == FAIL)
+	goto theend;
+
+    retval = tv_get_number_chk(&rettv, &error);
+    if (error)
+	retval = -1;
+    clear_tv(&rettv);
+
+theend:
+    set_vim_var_string(VV_VAL, NULL, 0);
+    restore_vimvar(VV_VAL, &save_val);
+    return retval;
+}
+
+/*
  * "readdir()" function
  */
     void