Patch 8.2.0209
Problem: Function a bit far away from where it's used.
Solution: Move function close to where it's used. (Ken Takata, closes #5569)
Files: src/fileio.c, src/filepath.c
*** ../vim-8.2.0208/src/fileio.c 2019-12-15 12:54:14.464144568 +0100
--- src/fileio.c 2020-02-04 22:32:14.570245802 +0100
***************
*** 4423,4439 ****
int (*checkitem)(void *context, char_u *name))
{
int failed = FALSE;
! #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
ga_init2(gap, (int)sizeof(char *), 20);
! #ifdef MSWIN
buf = alloc(MAXPATHL);
if (buf == NULL)
return FAIL;
--- 4423,4439 ----
int (*checkitem)(void *context, char_u *name))
{
int failed = FALSE;
! # 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
ga_init2(gap, (int)sizeof(char *), 20);
! # ifdef MSWIN
buf = alloc(MAXPATHL);
if (buf == NULL)
return FAIL;
***************
*** 4498,4504 ****
vim_free(buf);
vim_free(wn);
! #else
DIR *dirp;
struct dirent *dp;
char_u *p;
--- 4498,4504 ----
vim_free(buf);
vim_free(wn);
! # else
DIR *dirp;
struct dirent *dp;
char_u *p;
***************
*** 4547,4553 ****
closedir(dirp);
}
! #endif
if (!failed && gap->ga_len > 0)
sort_strings((char_u **)gap->ga_data, gap->ga_len);
--- 4547,4553 ----
closedir(dirp);
}
! # endif
if (!failed && gap->ga_len > 0)
sort_strings((char_u **)gap->ga_data, gap->ga_len);
*** ../vim-8.2.0208/src/filepath.c 2020-02-04 22:22:43.060586069 +0100
--- src/filepath.c 2020-02-04 22:32:14.570245802 +0100
***************
*** 1256,1296 ****
}
/*
- * 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.
--- 1256,1261 ----
***************
*** 1386,1391 ****
--- 1351,1391 ----
}
/*
+ * 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
*** ../vim-8.2.0208/src/version.c 2020-02-04 22:22:43.060586069 +0100
--- src/version.c 2020-02-04 22:32:09.326264541 +0100
***************
*** 744,745 ****
--- 744,747 ----
{ /* Add new patch number below this line */
+ /**/
+ 209,
/**/
--
Time is an illusion. Lunchtime doubly so.
-- Ford Prefect, in Douglas Adams'
"The Hitchhiker's Guide to the Galaxy"
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202002042133.014LXSZe009973%40masaka.moolenaar.net.