The original code (rather oddly) interprets a length of zero in

subvec() to mean "the whole vector".  Melchior showed a use case
(removal of the first element from a vector) where getting a
zero-length subvector is actually desired.  And since I can't come up
with a good reason for why the "feature" was there in the first place,
out it goes...
This commit is contained in:
andy 2006-03-21 22:22:47 +00:00
parent 6e973e07f4
commit 9d6c0dc580

View File

@ -69,7 +69,7 @@ static naRef subvec(naContext c, naRef me, int argc, naRef* args)
len = (int)nlen.num;
if(!naIsVector(v) || start < 0 || start >= naVec_size(v) || len < 0)
return naNil();
if(len == 0 || len > naVec_size(v) - start) len = naVec_size(v) - start;
if(len > naVec_size(v) - start) len = naVec_size(v) - start;
result = naNewVector(c);
naVec_setsize(result, len);
for(i=0; i<len; i++)