mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-05-28 10:56:08 +02:00
30455: remove max array length test
This commit is contained in:
parent
3e05817b77
commit
c335b7f0a1
|
@ -1,3 +1,7 @@
|
|||
2012-04-25 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 30455: NEWS, Src/params.c: remove max array length test.
|
||||
|
||||
2012-04-25 Mikael Magnusson <mikachu@gmail.com>
|
||||
|
||||
* 30429: Completion/Unix/Command/_init_d: Avoid error when the
|
||||
|
@ -16246,5 +16250,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.5642 $
|
||||
* $Revision: 1.5643 $
|
||||
*****************************************************
|
||||
|
|
19
NEWS
19
NEWS
|
@ -52,31 +52,38 @@ Expansion (parameters, globbing, etc.) and redirection
|
|||
This is useful for expanding paths with many variable components as
|
||||
commonly found in software development.
|
||||
|
||||
- Parameter expansion has the ${NAME:OFFSET} and ${NAME:OFFSET:LENGTH}
|
||||
- Parameter substitution has the ${NAME:OFFSET} and ${NAME:OFFSET:LENGTH}
|
||||
syntax for compatibility with other shells (and zero-based indexing
|
||||
is used to enhance compatibility). LENGTH may be negative to count
|
||||
from the end.
|
||||
|
||||
- The parameter expansion flag (D) abbreviates directories in parameters
|
||||
- The arbitrary limit on parameter subscripts (262144) has been removed.
|
||||
As it was not configurable and tested in an inconvenient place it
|
||||
was deemed preferable to remove it completely. The limit was originally
|
||||
introduced to prevent accidental creation of a large parameter array
|
||||
by typos that generated assignments along the lines of "12345678=0".
|
||||
The general advice is not to do that.
|
||||
|
||||
- The parameter substitution flag (D) abbreviates directories in parameters
|
||||
using the familiar ~ form.
|
||||
|
||||
- The parameter expansion flag (g) can take delimited arguments o, e and
|
||||
- The parameter substitution flag (g) can take delimited arguments o, e and
|
||||
c to provide echo- and print-style expansion: (g::) provides basic
|
||||
echo-style expansion; (g:e:) provides the extended capabilities of
|
||||
print; (g:o:) provides octal escapes without a leading zero; (g:c:)
|
||||
additionally expands "^c" style control characters as for bindkey.
|
||||
Options may be combined, e.g. (g:eoc:).
|
||||
|
||||
- The parameter expansion flag (m) indicates that string lengths used
|
||||
- The parameter substitution flag (m) indicates that string lengths used
|
||||
calculated by the (l) and (r) flags or the # operator should take
|
||||
account of the printing width of characters in multibyte mode, whether
|
||||
0, 1 or more. (mm) causes printing characters to count as 1 and
|
||||
non-printing chracters to count as 0.
|
||||
|
||||
- The parameter expansion flag (q-) picks the most minimal way of
|
||||
- The parameter substitution flag (q-) picks the most minimal way of
|
||||
quoting the parameter words, to make the result as readable as possible.
|
||||
|
||||
- The parameter expansion flag (Z), a variant of (z), takes arguments
|
||||
- The parameter substitution flag (Z), a variant of (z), takes arguments
|
||||
describing how to split a variable using shell syntax: (Z:c:) parses
|
||||
comments as strings (the default is not to treat comment characters
|
||||
specially); (Z:C:) parses comments and strips them; (Z:n:) treats
|
||||
|
|
13
Src/params.c
13
Src/params.c
|
@ -1905,6 +1905,18 @@ fetchvalue(Value v, char **pptr, int bracks, int flags)
|
|||
if (!bracks && *s)
|
||||
return NULL;
|
||||
*pptr = s;
|
||||
#if 0
|
||||
/*
|
||||
* Check for large subscripts that might be erroneous.
|
||||
* This code is too gross in several ways:
|
||||
* - the limit is completely arbitrary
|
||||
* - the test vetoes operations on existing arrays
|
||||
* - it's not at all clear a general test on large arrays of
|
||||
* this kind is any use.
|
||||
*
|
||||
* Until someone comes up with workable replacement code it's
|
||||
* therefore commented out.
|
||||
*/
|
||||
if (v->start > MAX_ARRLEN) {
|
||||
zerr("subscript too %s: %d", "big", v->start + !isset(KSHARRAYS));
|
||||
return NULL;
|
||||
|
@ -1921,6 +1933,7 @@ fetchvalue(Value v, char **pptr, int bracks, int flags)
|
|||
zerr("subscript too %s: %d", "small", v->end);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue