From: andy Date: Tue, 21 Mar 2006 22:22:47 +0000 (+0000) Subject: The original code (rather oddly) interprets a length of zero in X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9d6c0dc580d39ccf0f55416af0a3974a85195405;p=simgear.git 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... --- diff --git a/simgear/nasal/lib.c b/simgear/nasal/lib.c index 7984e3dd..abff3aa3 100644 --- a/simgear/nasal/lib.c +++ b/simgear/nasal/lib.c @@ -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