To: vim_dev@googlegroups.com Subject: Patch 8.1.1639 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1639 Problem: Changing an autoload name into a script file name is inefficient. Solution: Remember the last replaced #. (Ozaki Kiichi, closes #4618) Files: src/eval.c *** ../vim-8.1.1638/src/eval.c 2019-06-25 04:12:12.304665282 +0200 --- src/eval.c 2019-07-05 22:09:08.084680393 +0200 *************** *** 9219,9241 **** /* * Return the autoload script name for a function or variable name. * Returns NULL when out of memory. */ char_u * autoload_name(char_u *name) { ! char_u *p; char_u *scriptname; ! /* Get the script file name: replace '#' with '/', append ".vim". */ scriptname = alloc(STRLEN(name) + 14); if (scriptname == NULL) return FALSE; STRCPY(scriptname, "autoload/"); STRCAT(scriptname, name); ! *vim_strrchr(scriptname, AUTOLOAD_CHAR) = NUL; ! STRCAT(scriptname, ".vim"); ! while ((p = vim_strchr(scriptname, AUTOLOAD_CHAR)) != NULL) *p = '/'; return scriptname; } --- 9219,9242 ---- /* * Return the autoload script name for a function or variable name. * Returns NULL when out of memory. + * Caller must make sure that "name" contains AUTOLOAD_CHAR. */ char_u * autoload_name(char_u *name) { ! char_u *p, *q = NULL; char_u *scriptname; ! // Get the script file name: replace '#' with '/', append ".vim". scriptname = alloc(STRLEN(name) + 14); if (scriptname == NULL) return FALSE; STRCPY(scriptname, "autoload/"); STRCAT(scriptname, name); ! for (p = scriptname + 9; (p = vim_strchr(p, AUTOLOAD_CHAR)) != NULL; ! q = p, ++p) *p = '/'; + STRCPY(q, ".vim"); return scriptname; } *** ../vim-8.1.1638/src/version.c 2019-07-05 21:53:14.939268472 +0200 --- src/version.c 2019-07-05 22:10:40.431858564 +0200 *************** *** 779,780 **** --- 779,782 ---- { /* Add new patch number below this line */ + /**/ + 1639, /**/ -- I still remember when I gave up Smoking, Drinking and Sex. It was the most *horrifying* hour of my life! /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///