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 (<IN>) {
    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 (<IN>) {
    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 -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui