]> granicus.if.org Git - vim/commitdiff
patch 8.2.0209: function a bit far away from where it's used v8.2.0209
authorBram Moolenaar <Bram@vim.org>
Tue, 4 Feb 2020 21:32:59 +0000 (22:32 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 4 Feb 2020 21:32:59 +0000 (22:32 +0100)
Problem:    Function a bit far away from where it's used.
Solution:   Move function close to where it's used. (Ken Takata, closes #5569)

src/fileio.c
src/filepath.c
src/version.c

index e35ce8c7b2facb94b46a466b5e9dab4a031727e1..575efafd246a12f04316c69ade0a99f9403e37a4 100644 (file)
@@ -4423,17 +4423,17 @@ readdir_core(
     int                (*checkitem)(void *context, char_u *name))
 {
     int                        failed = FALSE;
-#ifdef MSWIN
+# ifdef MSWIN
     char_u             *buf, *p;
     int                        ok;
     HANDLE             hFind = INVALID_HANDLE_VALUE;
     WIN32_FIND_DATAW    wfb;
     WCHAR              *wn = NULL;     // UTF-16 name, NULL when not used.
-#endif
+# endif
 
     ga_init2(gap, (int)sizeof(char *), 20);
 
-#ifdef MSWIN
+# ifdef MSWIN
     buf = alloc(MAXPATHL);
     if (buf == NULL)
        return FAIL;
@@ -4498,7 +4498,7 @@ readdir_core(
 
     vim_free(buf);
     vim_free(wn);
-#else
+# else
     DIR                *dirp;
     struct dirent *dp;
     char_u     *p;
@@ -4547,7 +4547,7 @@ readdir_core(
 
        closedir(dirp);
     }
-#endif
+# endif
 
     if (!failed && gap->ga_len > 0)
        sort_strings((char_u **)gap->ga_data, gap->ga_len);
index 4517f412ce6aa3e15876577e406787ed5d592567..9a5d127ece4c7770624127ae2edec93543b15289 100644 (file)
@@ -1255,41 +1255,6 @@ f_isdirectory(typval_T *argvars, typval_T *rettv)
     rettv->vval.v_number = mch_isdir(tv_get_string(&argvars[0]));
 }
 
-/*
- * 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.
@@ -1385,6 +1350,41 @@ f_pathshorten(typval_T *argvars, typval_T *rettv)
     }
 }
 
+/*
+ * 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
  */
index 6e598e588304f34ebd72eb85f015e35ed52f5030..aae2526c8b9b2ebb13e204582d9a1b3ef52fc011 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    209,
 /**/
     208,
 /**/