comparison src/fileio.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 4481f3b29fc5
children 2bb0e80fcd32
comparison
equal deleted inserted replaced
19300:1911a4f14ae9 19301:80baa37506d0
4421 char_u *path, 4421 char_u *path,
4422 void *context, 4422 void *context,
4423 int (*checkitem)(void *context, char_u *name)) 4423 int (*checkitem)(void *context, char_u *name))
4424 { 4424 {
4425 int failed = FALSE; 4425 int failed = FALSE;
4426 #ifdef MSWIN 4426 # ifdef MSWIN
4427 char_u *buf, *p; 4427 char_u *buf, *p;
4428 int ok; 4428 int ok;
4429 HANDLE hFind = INVALID_HANDLE_VALUE; 4429 HANDLE hFind = INVALID_HANDLE_VALUE;
4430 WIN32_FIND_DATAW wfb; 4430 WIN32_FIND_DATAW wfb;
4431 WCHAR *wn = NULL; // UTF-16 name, NULL when not used. 4431 WCHAR *wn = NULL; // UTF-16 name, NULL when not used.
4432 #endif 4432 # endif
4433 4433
4434 ga_init2(gap, (int)sizeof(char *), 20); 4434 ga_init2(gap, (int)sizeof(char *), 20);
4435 4435
4436 #ifdef MSWIN 4436 # ifdef MSWIN
4437 buf = alloc(MAXPATHL); 4437 buf = alloc(MAXPATHL);
4438 if (buf == NULL) 4438 if (buf == NULL)
4439 return FAIL; 4439 return FAIL;
4440 STRNCPY(buf, path, MAXPATHL-5); 4440 STRNCPY(buf, path, MAXPATHL-5);
4441 p = buf + STRLEN(buf); 4441 p = buf + STRLEN(buf);
4496 FindClose(hFind); 4496 FindClose(hFind);
4497 } 4497 }
4498 4498
4499 vim_free(buf); 4499 vim_free(buf);
4500 vim_free(wn); 4500 vim_free(wn);
4501 #else 4501 # else
4502 DIR *dirp; 4502 DIR *dirp;
4503 struct dirent *dp; 4503 struct dirent *dp;
4504 char_u *p; 4504 char_u *p;
4505 4505
4506 dirp = opendir((char *)path); 4506 dirp = opendir((char *)path);
4545 } 4545 }
4546 } 4546 }
4547 4547
4548 closedir(dirp); 4548 closedir(dirp);
4549 } 4549 }
4550 #endif 4550 # endif
4551 4551
4552 if (!failed && gap->ga_len > 0) 4552 if (!failed && gap->ga_len > 0)
4553 sort_strings((char_u **)gap->ga_data, gap->ga_len); 4553 sort_strings((char_u **)gap->ga_data, gap->ga_len);
4554 4554
4555 return failed ? FAIL : OK; 4555 return failed ? FAIL : OK;