From d4948c45d3e5f54823fac68f0c11f1dd09e75083 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Thu, 4 Oct 2007 22:20:38 +0800 Subject: [PARSER] Size optimisations in parameter expansion parser Merge flags into subtype. Do not write subtype out twice. Add likely flag on ${ vs. $NAME. Kill unnecessary (and bogus) PEOA check. --- ChangeLog | 1 + src/parser.c | 16 +++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3352429..940e4b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2007-10-04 Herbert Xu * Fix parsing of ${##1}. + * Size optimisations in parameter expansion parser. 2007-10-04 Alexey Gladkov diff --git a/src/parser.c b/src/parser.c index 9edb824..f49ee7d 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1142,7 +1142,6 @@ parseredir: { parsesub: { int subtype; int typeloc; - int flags; char *p; static const char types[] = "}-+?="; @@ -1163,18 +1162,18 @@ parsesub: { } else { USTPUTC(CTLVAR, out); typeloc = out - (char *)stackblock(); - USTPUTC(VSNORMAL, out); + STADJUST(1, out); subtype = VSNORMAL; - if (c == '{') { + if (likely(c == '{')) { c = pgetc(); subtype = 0; } varname: - if (c > PEOA && is_name(c)) { + if (is_name(c)) { do { STPUTC(c, out); c = pgetc(); - } while (c > PEOA && is_in_name(c)); + } while (is_in_name(c)); } else if (is_digit(c)) { do { STPUTC(c, out); @@ -1208,18 +1207,17 @@ varname: badsub: synerror("Bad substitution"); STPUTC('=', out); - flags = 0; if (subtype == 0) { switch (c) { case ':': - flags = VSNUL; + subtype = VSNUL; c = pgetc(); /*FALLTHROUGH*/ default: p = strchr(types, c); if (p == NULL) goto badsub; - subtype = p - types + VSNORMAL; + subtype |= p - types + VSNORMAL; break; case '%': case '#': @@ -1238,7 +1236,7 @@ badsub: synerror("Bad substitution"); } else { pungetc(); } - *((char *)stackblock() + typeloc) = subtype | flags; + *((char *)stackblock() + typeloc) = subtype; if (subtype != VSNORMAL) { varnest++; if (dblquote) -- cgit 1.4.1 7bb63b3b53d8e623257a6fea96dc6da5d&showmsg=1'>unfollow)
Commit message (Collapse)Author
2012-03-03Update Vim-Tomorrow-ThemeJune McEnroe
2012-03-02Update Vim-Tomorrow-ThemeJune McEnroe
2012-02-29Update PowerlineJune McEnroe
2012-02-29Add shiftround optionJune McEnroe
2012-02-25Add ,z mapping to toggle spellJune McEnroe
2012-02-13Add badwolf colorschemeJune McEnroe
2012-02-11Customize C/C++ indentationJune McEnroe
2012-02-07Update Powerline to 'develop' branchJune McEnroe
2012-02-07Add Solarized colorschemeJune McEnroe
2012-02-07Add back set nocompatible, even though it seemed to end up set anywayJune McEnroe
2012-02-05Update jellybeansJune McEnroe
2012-02-02Update itchy.vimJune McEnroe
2012-02-02Add mapping to toggle relative/absolute numberingJune McEnroe
2012-02-02Add itchy.vimJune McEnroe
2012-02-01Revert "Add ShowMarks plugin"June McEnroe
This reverts commit 28cf15ba0309361cb972012bb3bdad62423f401d.
2012-02-01Add ShowMarks pluginJune McEnroe
2012-02-01Update Vim-Tomorrow-ThemeJune McEnroe
2012-02-01Add vim-markdownJune McEnroe
2012-02-01Add tabular.vimJune McEnroe
2012-02-01Update Vim-Tomorrow-ThemeJune McEnroe
PS. Chris Kempson is a jerk.
2012-01-30Disable menu bar in GVimJune McEnroe
2012-01-30Set shiftwidth to 4 for LuaJune McEnroe
2012-01-29Don't show Syntastic errors automaticallyJune McEnroe
2012-01-28Update to Quicktask 1.1June McEnroe
2012-01-22Use space-test branch of quicktaskJune McEnroe
2012-01-22Enable syntax-based foldingJune McEnroe
2012-01-22Update quicktaskJune McEnroe
2012-01-22Revert "Add AutoClose"June McEnroe
This reverts commit 39cfdd62ba82f93f68a2b5fa7b5771303d8b9dee. This fixes the delay when leaving insert mode
2012-01-22Revert "Disable powerline for now"June McEnroe
This reverts commit fa48f5965c57272e616721d92475cd2f1e35f667.
2012-01-22Revert "Add VCS repo directories to wildignore"June McEnroe
This reverts commit 41cb1db33ba7b64d8af63bf55bb82f7e8a617518. This fixes not being able to commit with vim-fugitive
2012-01-22Disable powerline for nowJune McEnroe
2012-01-22Update some pluginsJune McEnroe
2012-01-22Add VCS repo directories to wildignoreJune McEnroe
2012-01-22Map ,e and ,b to CtrlP file and buffer respectivelyJune McEnroe
2012-01-22Add vim-spaceJune McEnroe
2012-01-22Add AutoCloseJune McEnroe
2012-01-22Add binding for GundoJune McEnroe
2012-01-22Add GundoJune McEnroe
2012-01-22Add Jellybeans colorschemeJune McEnroe
2012-01-22Add syntasticJune McEnroe
2012-01-21Add PowerlineJune McEnroe
2012-01-21Add quicktaskJune McEnroe
2012-01-15Moved comments out of mapsJune McEnroe
2012-01-14Disable scrollbarsJune McEnroe