1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-04 20:40:57 +02:00

43695: minor but simple optmiisation to use existing string length

This commit is contained in:
Sebastian Gniazdowski 2018-10-17 00:08:01 +02:00 committed by Peter Stephenson
parent 07d06c9fb9
commit 5556e00c65
2 changed files with 9 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2018-10-23 Peter Stephenson <p.stephenson@samsung.com>
* Sebastian: 43695: Src/lex.c: minor but simple optimisation
to reuse existing string lengths.
2018-10-22 dana <dana@dana.is>
* 43713: Completion/Unix/Command/_init_d: Improve completion of

View file

@ -1626,7 +1626,7 @@ parsestrnoerr(char **s)
zcontext_save();
untokenize(*s);
inpush(dupstring(*s), 0, NULL);
inpush(dupstring_wlen(*s, l), 0, NULL);
strinbeg(0);
lexbuf.len = 0;
lexbuf.ptr = tokstr = *s;
@ -1658,7 +1658,7 @@ parse_subscript(char *s, int sub, int endchar)
if (!*s || *s == endchar)
return 0;
zcontext_save();
untokenize(t = dupstring(s));
untokenize(t = dupstring_wlen(s, l));
inpush(t, 0, NULL);
strinbeg(0);
/*
@ -1674,7 +1674,7 @@ parse_subscript(char *s, int sub, int endchar)
* length preservation.
*/
lexbuf.len = 0;
lexbuf.ptr = tokstr = dupstring(s);
lexbuf.ptr = tokstr = dupstring_wlen(s, l);
lexbuf.siz = l + 1;
err = dquote_parse(endchar, sub);
toklen = (int)(lexbuf.ptr - tokstr);
@ -1713,7 +1713,7 @@ parse_subst_string(char *s)
return 0;
zcontext_save();
untokenize(s);
inpush(dupstring(s), 0, NULL);
inpush(dupstring_wlen(s, l), 0, NULL);
strinbeg(0);
lexbuf.len = 0;
lexbuf.ptr = tokstr = s;