Skip to content

Commit 80147dd

Browse files
committed
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 #5569)
1 parent d816cd9 commit 80147dd

3 files changed

Lines changed: 42 additions & 40 deletions

File tree

src/fileio.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4423,17 +4423,17 @@ readdir_core(
44234423
int (*checkitem)(void *context, char_u *name))
44244424
{
44254425
int failed = FALSE;
4426-
#ifdef MSWIN
4426+
# ifdef MSWIN
44274427
char_u *buf, *p;
44284428
int ok;
44294429
HANDLE hFind = INVALID_HANDLE_VALUE;
44304430
WIN32_FIND_DATAW wfb;
44314431
WCHAR *wn = NULL; // UTF-16 name, NULL when not used.
4432-
#endif
4432+
# endif
44334433

44344434
ga_init2(gap, (int)sizeof(char *), 20);
44354435

4436-
#ifdef MSWIN
4436+
# ifdef MSWIN
44374437
buf = alloc(MAXPATHL);
44384438
if (buf == NULL)
44394439
return FAIL;
@@ -4498,7 +4498,7 @@ readdir_core(
44984498

44994499
vim_free(buf);
45004500
vim_free(wn);
4501-
#else
4501+
# else
45024502
DIR *dirp;
45034503
struct dirent *dp;
45044504
char_u *p;
@@ -4547,7 +4547,7 @@ readdir_core(
45474547

45484548
closedir(dirp);
45494549
}
4550-
#endif
4550+
# endif
45514551

45524552
if (!failed && gap->ga_len > 0)
45534553
sort_strings((char_u **)gap->ga_data, gap->ga_len);

src/filepath.c

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,41 +1255,6 @@ f_isdirectory(typval_T *argvars, typval_T *rettv)
12551255
rettv->vval.v_number = mch_isdir(tv_get_string(&argvars[0]));
12561256
}
12571257

1258-
/*
1259-
* Evaluate "expr" (= "context") for readdir().
1260-
*/
1261-
static int
1262-
readdir_checkitem(void *context, char_u *name)
1263-
{
1264-
typval_T *expr = (typval_T *)context;
1265-
typval_T save_val;
1266-
typval_T rettv;
1267-
typval_T argv[2];
1268-
int retval = 0;
1269-
int error = FALSE;
1270-
1271-
if (expr->v_type == VAR_UNKNOWN)
1272-
return 1;
1273-
1274-
prepare_vimvar(VV_VAL, &save_val);
1275-
set_vim_var_string(VV_VAL, name, -1);
1276-
argv[0].v_type = VAR_STRING;
1277-
argv[0].vval.v_string = name;
1278-
1279-
if (eval_expr_typval(expr, argv, 1, &rettv) == FAIL)
1280-
goto theend;
1281-
1282-
retval = tv_get_number_chk(&rettv, &error);
1283-
if (error)
1284-
retval = -1;
1285-
clear_tv(&rettv);
1286-
1287-
theend:
1288-
set_vim_var_string(VV_VAL, NULL, 0);
1289-
restore_vimvar(VV_VAL, &save_val);
1290-
return retval;
1291-
}
1292-
12931258
/*
12941259
* Create the directory in which "dir" is located, and higher levels when
12951260
* needed.
@@ -1385,6 +1350,41 @@ f_pathshorten(typval_T *argvars, typval_T *rettv)
13851350
}
13861351
}
13871352

1353+
/*
1354+
* Evaluate "expr" (= "context") for readdir().
1355+
*/
1356+
static int
1357+
readdir_checkitem(void *context, char_u *name)
1358+
{
1359+
typval_T *expr = (typval_T *)context;
1360+
typval_T save_val;
1361+
typval_T rettv;
1362+
typval_T argv[2];
1363+
int retval = 0;
1364+
int error = FALSE;
1365+
1366+
if (expr->v_type == VAR_UNKNOWN)
1367+
return 1;
1368+
1369+
prepare_vimvar(VV_VAL, &save_val);
1370+
set_vim_var_string(VV_VAL, name, -1);
1371+
argv[0].v_type = VAR_STRING;
1372+
argv[0].vval.v_string = name;
1373+
1374+
if (eval_expr_typval(expr, argv, 1, &rettv) == FAIL)
1375+
goto theend;
1376+
1377+
retval = tv_get_number_chk(&rettv, &error);
1378+
if (error)
1379+
retval = -1;
1380+
clear_tv(&rettv);
1381+
1382+
theend:
1383+
set_vim_var_string(VV_VAL, NULL, 0);
1384+
restore_vimvar(VV_VAL, &save_val);
1385+
return retval;
1386+
}
1387+
13881388
/*
13891389
* "readdir()" function
13901390
*/

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ static char *(features[]) =
742742

743743
static int included_patches[] =
744744
{ /* Add new patch number below this line */
745+
/**/
746+
209,
745747
/**/
746748
208,
747749
/**/

0 commit comments

Comments
 (0)