vfs: strlen optimization

This commit is contained in:
2025-03-10 12:51:06 +01:00
parent 3772192c77
commit ff40462779
3 changed files with 4 additions and 1 deletions

View File

@ -352,6 +352,8 @@ void vfs_config_load(struct vfs_config *cfg, const wchar_t *filename)
cfg->redirections_to[i],
_countof(cfg->redirections_to[i]),
filename);
cfg->redirections_from_len[i] = (int)wcslen(cfg->redirections_from[i]);
}
}

View File

@ -571,7 +571,7 @@ static HRESULT vfs_custom_path_hook(
return S_FALSE;
}
if (path_compare_w(src, from, wcslen(from)) != 0) {
if (path_compare_w(src, from, vfs_config.redirections_from_len[i]) != 0) {
continue;
}

View File

@ -13,6 +13,7 @@ struct vfs_config {
wchar_t appdata[MAX_PATH];
wchar_t option[MAX_PATH];
wchar_t redirections_from[MAX_REDIRECTIONS][MAX_PATH];
int redirections_from_len[MAX_REDIRECTIONS];
wchar_t redirections_to[MAX_REDIRECTIONS][MAX_PATH];
};