Skip to content

Commit 980128c

Browse files
committed
patch 8.0.0514: script for creating cmdidxs can be improved
Problem: Script for creating cmdidxs can be improved. Solution: Count skipped lines instead of collecting the lines. Add "const". (Dominique Pelle, closes #1594)
1 parent c96272e commit 980128c

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/create_cmdidxs.pl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99
# Script should be run every time new Ex commands are added in Vim,
1010
# from the src/vim directory, since it reads commands from "ex_cmds.h".
1111

12+
use strict;
13+
1214
# Find the list of Vim commands from cmdnames[] table in ex_cmds.h
1315
my @cmds;
14-
my @skipped;
16+
my $skipped_cmds;
1517
open(IN, "< ex_cmds.h") or die "can't open ex_cmds.h: $!\n";
1618
while (<IN>) {
1719
if (/^EX\(CMD_\S*,\s*"([a-z][^"]*)"/) {
18-
push (@cmds, $1);
20+
push @cmds, $1;
1921
} elsif (/^EX\(CMD_/) {
20-
push (@skipped, $1);
22+
++$skipped_cmds;
2123
}
2224
}
2325

@@ -68,7 +70,6 @@
6870
}
6971
print "};\n",
7072
"\n",
71-
"static int command_count = ", $#cmds + $#skipped + 2 , ";\n",
73+
"static const int command_count = ", scalar(@cmds) + $skipped_cmds, ";\n",
7274
"\n",
7375
"/* End of automatically generated code by create_cmdidxs.pl */\n";
74-

src/ex_docmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ static const unsigned char cmdidxs2[26][26] =
566566
/* 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, }
567567
};
568568

569-
static int command_count = 539;
569+
static const int command_count = 539;
570570

571571
/* End of automatically generated code by create_cmdidxs.pl */
572572

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
514,
767769
/**/
768770
513,
769771
/**/

0 commit comments

Comments
 (0)