From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 References: In-Reply-To: From: "James A. Robinson" Date: Fri, 12 Aug 2016 15:48:55 +0000 Message-ID: To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=001a1137806489c5000539e1d221 Subject: Re: [9fans] bufreset deletes b->nbl-1 blocks? Topicbox-Message-UUID: 97180dca-ead9-11e9-9d60-3106f5b1d025 --001a1137806489c5000539e1d221 Content-Type: text/plain; charset=UTF-8 On Fri, Aug 12, 2016 at 8:32 AM Costin Chirvasuta wrote: > > So isn't the memmove just to cover the case where you are > > deleting a block that isn't at the very end? > > Yes, but from what I understand i is always lower. > > Say b->nbl starts at 10. i=b->nbl-1 so i=9. --i so i=8. > Inside delblock b->nbl-- so b->nbl is 9. i happens. > > Also delblock(b, 0) never seems to happen. > My apologies, I wasn't paying enough attention. Yes, I think you're correct that if b->nbl is 10 it would start off with deblock(b, 8). Why wouldn't delblock(b, 0) be called? Wouldn't the sequence end up being 8,7,6,5,4,3,2,1,0, since only when it hits i=-1 would it evaluate to false? Jim --001a1137806489c5000539e1d221 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Fri, Aug 12= , 2016 at 8:32 AM Costin Chirvasuta <costinc@gmail.com> wrote:
= > So isn't the memmove just to cover the case where you are
> deleting a block that isn't at the very end?

Yes, but from what I understand i is always lower.

Say b->nbl starts at 10. i=3Db->nbl-1 so i=3D9. --i so i=3D8.
Inside delblock b->nbl-- so b->nbl is 9. i<nbl is true so the memm= ove happens.

Also delblock(b, 0) never seems to happen.

<= div>My apologies, I wasn't paying enough attention.=C2=A0 Yes, I think = you're correct that if b->nbl is 10 it would start off with deblock(= b, 8).

Why wouldn't delblock(b, 0) be called?= =C2=A0 Wouldn't the sequence end up being 8,7,6,5,4,3,2,1,0, since only= when it hits i=3D-1 would it evaluate to false?

J= im

--001a1137806489c5000539e1d221--