To: vim_dev@googlegroups.com Subject: Patch 8.0.0514 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0514 Problem: Script for creating cmdidxs can be improved. Solution: Count skipped lines instead of collecting the lines. Add "const". (Dominique Pelle, closes #1594) Files: src/create_cmdidxs.pl, src/ex_docmd.c *** ../vim-8.0.0513/src/create_cmdidxs.pl 2017-03-25 14:50:37.921991987 +0100 --- src/create_cmdidxs.pl 2017-03-26 21:42:57.447046140 +0200 *************** *** 9,23 **** # Script should be run every time new Ex commands are added in Vim, # from the src/vim directory, since it reads commands from "ex_cmds.h". # Find the list of Vim commands from cmdnames[] table in ex_cmds.h my @cmds; ! my @skipped; open(IN, "< ex_cmds.h") or die "can't open ex_cmds.h: $!\n"; while () { if (/^EX\(CMD_\S*,\s*"([a-z][^"]*)"/) { ! push (@cmds, $1); } elsif (/^EX\(CMD_/) { ! push (@skipped, $1); } } --- 9,25 ---- # Script should be run every time new Ex commands are added in Vim, # from the src/vim directory, since it reads commands from "ex_cmds.h". + use strict; + # Find the list of Vim commands from cmdnames[] table in ex_cmds.h my @cmds; ! my $skipped_cmds; open(IN, "< ex_cmds.h") or die "can't open ex_cmds.h: $!\n"; while () { if (/^EX\(CMD_\S*,\s*"([a-z][^"]*)"/) { ! push @cmds, $1; } elsif (/^EX\(CMD_/) { ! ++$skipped_cmds; } } *************** *** 68,74 **** } print "};\n", "\n", ! "static int command_count = ", $#cmds + $#skipped + 2 , ";\n", "\n", "/* End of automatically generated code by create_cmdidxs.pl */\n"; - --- 70,75 ---- } print "};\n", "\n", ! "static const int command_count = ", scalar(@cmds) + $skipped_cmds, ";\n", "\n", "/* End of automatically generated code by create_cmdidxs.pl */\n"; *** ../vim-8.0.0513/src/ex_docmd.c 2017-03-25 15:07:38.750256076 +0100 --- src/ex_docmd.c 2017-03-26 21:44:58.934091555 +0200 *************** *** 566,572 **** /* z */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, } }; ! static int command_count = 539; /* End of automatically generated code by create_cmdidxs.pl */ --- 566,572 ---- /* z */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, } }; ! static const int command_count = 539; /* End of automatically generated code by create_cmdidxs.pl */ *** ../vim-8.0.0513/src/version.c 2017-03-26 13:50:02.536929400 +0200 --- src/version.c 2017-03-26 21:44:11.590463183 +0200 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 514, /**/ -- I noticed my daughter's Disney-net password on a sticky note: "MickeyMinnieGoofyPluto". I asked her why it was so long. "Because they say it has to have at least four characters." /// 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 ///