]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.0.0514: script for creating cmdidxs can be improved v8.0.0514
authorBram Moolenaar <Bram@vim.org>
Sun, 26 Mar 2017 19:46:28 +0000 (21:46 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 26 Mar 2017 19:46:28 +0000 (21:46 +0200)
Problem:    Script for creating cmdidxs can be improved.
Solution:   Count skipped lines instead of collecting the lines.  Add "const".
            (Dominique Pelle, closes #1594)

src/create_cmdidxs.pl
src/ex_docmd.c
src/version.c

index ff8dcc3f4bcb376b12b254dc5f702da232c63160..d39ac1614ae15669d8e089912372abc47e4d5e3b 100644 (file)
@@ -9,15 +9,17 @@
 # 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;
+my $skipped_cmds;
 open(IN, "< ex_cmds.h") or die "can't open ex_cmds.h: $!\n";
 while (<IN>) {
   if (/^EX\(CMD_\S*,\s*"([a-z][^"]*)"/) {
-    push (@cmds, $1);
+    push @cmds, $1;
   } elsif (/^EX\(CMD_/) {
-    push (@skipped, $1);
+    ++$skipped_cmds;
   }
 }
 
@@ -68,7 +70,6 @@ for my $c1 ('a' .. 'z') {
 }
 print "};\n",
       "\n",
-      "static int command_count = ", $#cmds + $#skipped + 2 , ";\n",
+      "static const int command_count = ", scalar(@cmds) + $skipped_cmds, ";\n",
       "\n",
       "/* End of automatically generated code by create_cmdidxs.pl */\n";
-
index 9782557c13ea317fb2fb68402f4ff50ceb6540fb..8755f0549b02f21521e7e75ea36eece7c853ea81 100644 (file)
@@ -566,7 +566,7 @@ static const unsigned char cmdidxs2[26][26] =
   /* 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;
+static const int command_count = 539;
 
 /* End of automatically generated code by create_cmdidxs.pl */
 
index 28f3c59d11353e7202dda8263df815308b45010c..79c97f9b96e8611fba1c81d69cf6754c7fa75047 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    514,
 /**/
     513,
 /**/