Patch 9.0.1464

4 views
Skip to first unread message

Bram Moolenaar

unread,
Apr 17, 2023, 5:32:19 PM4/17/23
to vim...@googlegroups.com

Patch 9.0.1464
Problem: Strace filetype detection is expensive.
Solution: Match with a cheap pattern first. (Federico Mengozzi,
closes #12220)
Files: runtime/autoload/dist/script.vim, src/testdir/test_filetype.vim


*** ../vim-9.0.1463/runtime/autoload/dist/script.vim 2022-11-24 10:58:07.659390137 +0000
--- runtime/autoload/dist/script.vim 2023-04-17 22:30:03.237008075 +0100
***************
*** 338,344 ****
set ft=virata

# Strace
! elseif line1 =~ '[0-9:.]* *execve(' || line1 =~ '^__libc_start_main'
set ft=strace

# VSE JCL
--- 338,346 ----
set ft=virata

# Strace
! # inaccurate fast match first, then use accurate slow match
! elseif (line1 =~ 'execve(' && line1 =~ '^[0-9:.]* *execve(')
! || line1 =~ '^__libc_start_main'
set ft=strace

# VSE JCL
*** ../vim-9.0.1463/src/testdir/test_filetype.vim 2023-04-15 18:17:14.315951544 +0100
--- src/testdir/test_filetype.vim 2023-04-17 22:26:51.548979470 +0100
***************
*** 733,738 ****
--- 733,743 ----
filetype off
endfunc

+ " Content lines that should not result in filetype detection
+ let s:false_positive_checks = {
+ \ '': [['test execve("/usr/bin/pstree", ["pstree"], 0x7ff0 /* 63 vars */) = 0']],
+ \ }
+
" Filetypes detected from the file contents by scripts.vim
let s:script_checks = {
\ 'virata': [['% Virata'],
***************
*** 824,829 ****
--- 829,835 ----
endfunc

func Test_script_detection()
+ call Run_script_detection(s:false_positive_checks)
call Run_script_detection(s:script_checks)
call Run_script_detection(s:script_env_checks)
endfunc
*** ../vim-9.0.1463/src/version.c 2023-04-17 21:44:32.436275188 +0100
--- src/version.c 2023-04-17 22:28:18.772995302 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1464,
/**/

--
How do you know when you have run out of invisible ink?

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages