patch 9.1.1715: Some functions need to be re-ordered

Problem:  Some functions need to be re-ordered
Solution: Re-order and move functions around favoring mch_*() functions
          inside os_*.c files, Change scope of dos_expandpath() to
          global instead of static (Hirohito Higashi)

The following fixes and tweaks have been made:

- Moved the definition of mch_expandpath() from filepath.c to os_win32.c
  in MS-Windows builds (essentially, the mch_~() function should be
  defined in os_~.c.)
- In accordance with the above, the scope of dos_expandpath() has been
  changed from static to global.
- Other miscellaneous changes.

closes: #18176

Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Hirohito Higashi
2025-08-31 18:52:32 +02:00
committed by Christian Brabandt
parent 2eccb4d0be
commit 7292964267
8 changed files with 23 additions and 13 deletions

View File

@ -3523,7 +3523,7 @@ pstrcmp(const void *a, const void *b)
* Return the number of matches found.
* NOTE: much of this is identical to unix_expandpath(), keep in sync!
*/
static int
int
dos_expandpath(
garray_T *gap,
char_u *path,
@ -3751,15 +3751,6 @@ dos_expandpath(
sizeof(char_u *), pstrcmp);
return matches;
}
int
mch_expandpath(
garray_T *gap,
char_u *path,
int flags) // EW_* flags
{
return dos_expandpath(gap, path, 0, flags, FALSE);
}
#endif // MSWIN
#if (defined(UNIX) && !defined(VMS)) || defined(USE_UNIXFILENAME) \

View File

@ -7698,6 +7698,21 @@ mch_total_mem(int special UNUSED)
return (long_u)((ms.ullTotalPhys - WINNT_RESERVE_BYTES) / 1024);
}
/*
* Expand a path into all matching files and/or directories. Handles "*",
* "?", "[a-z]", "**", etc.
* "path" has backslashes before chars that are not to be expanded.
* Returns the number of matches found.
*/
int
mch_expandpath(
garray_T *gap,
char_u *path,
int flags) // EW_* flags
{
return dos_expandpath(gap, path, 0, flags, FALSE);
}
/*
* mch_wrename() works around a bug in rename (aka MoveFile) in
* Windows, the bug can be demonstrated with the following scenario:

View File

@ -25,5 +25,5 @@ int wildmenu_process_key(cmdline_info_T *cclp, int key, expand_T *xp);
void wildmenu_cleanup(cmdline_info_T *cclp);
void f_getcompletion(typval_T *argvars, typval_T *rettv);
void f_getcompletiontype(typval_T *argvars, typval_T *rettv);
void f_cmdcomplete_info(typval_T *argvars UNUSED, typval_T *rettv);
void f_cmdcomplete_info(typval_T *argvars, typval_T *rettv);
/* vim: set ft=c : */

View File

@ -55,6 +55,7 @@ int vim_fexists(char_u *fname);
int expand_wildcards_eval(char_u **pat, int *num_file, char_u ***file, int flags);
int expand_wildcards(int num_pat, char_u **pat, int *num_files, char_u ***files, int flags);
int match_suffix(char_u *fname);
int dos_expandpath(garray_T *gap, char_u *path, size_t wildoff, int flags, int didstar);
int unix_expandpath(garray_T *gap, char_u *path, size_t wildoff, int flags, int didstar);
int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, int flags);
void addfile(garray_T *gap, char_u *f, int flags);

View File

@ -1,7 +1,7 @@
/* if_xcmdsrv.c */
int serverRegisterName(Display *dpy, char_u *name);
void serverChangeRegisteredWindow(Display *dpy, Window newwin);
int serverSendToVim(Display *dpy, char_u *name, char_u *cmd, char_u **result, Window *server, int asExpr, int timeout, int localLoop, int silent);
int serverSendToVim(Display *dpy, char_u *name, char_u *cmd, char_u **result, Window *server, Bool asExpr, int timeout, Bool localLoop, int silent);
char_u *serverGetVimNames(Display *dpy);
Window serverStrToWin(char_u *str);
int serverSendReply(char_u *name, char_u *str);

View File

@ -61,6 +61,7 @@ void mch_delay(long msec, int flags);
int mch_remove(char_u *name);
void mch_breakcheck(int force);
long_u mch_total_mem(int special);
int mch_expandpath(garray_T *gap, char_u *path, int flags);
int mch_wrename(WCHAR *wold, WCHAR *wnew);
int mch_rename(const char *pszOldFile, const char *pszNewFile);
char *default_shell(void);

View File

@ -67,8 +67,8 @@ char_u *tv_get_string_buf_chk_strict(typval_T *varp, char_u *buf, int strict);
char_u *tv_stringify(typval_T *varp, char_u *buf);
int tv_check_lock(typval_T *tv, char_u *name, int use_gettext);
void copy_tv(typval_T *from, typval_T *to);
int typval_compare(typval_T *tv1, typval_T *tv2, exprtype_T type, int ic);
int typval_compare2(typval_T *tv1, typval_T *tv2, exprtype_T type, int ic, int *res);
int typval_compare(typval_T *tv1, typval_T *tv2, exprtype_T type, int ic);
int typval_compare_list(typval_T *tv1, typval_T *tv2, exprtype_T type, int ic, int *res);
int typval_compare_tuple(typval_T *tv1, typval_T *tv2, exprtype_T type, int ic, int *res);
int typval_compare_null(typval_T *tv1, typval_T *tv2);

View File

@ -724,6 +724,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1715,
/**/
1714,
/**/