9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "James A. Robinson" <jim.robinson@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] bufreset deletes b->nbl-1 blocks?
Date: Fri, 12 Aug 2016 15:48:55 +0000	[thread overview]
Message-ID: <CAPd04b5+aikz7uK9VpjzxWaf58MgkT0WbDnSBZ37L_RKLyD5Ow@mail.gmail.com> (raw)
In-Reply-To: <CAPv5z_0RUfRBszV07h0vzxA_YrUYV+_KMgwXfJEQTbdMJUBBrA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 752 bytes --]

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=b->nbl-1 so i=9. --i so i=8.
> Inside delblock b->nbl-- so b->nbl is 9. i<nbl is true so the memmove
> 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

[-- Attachment #2: Type: text/html, Size: 1129 bytes --]

  reply	other threads:[~2016-08-12 15:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12 12:30 Costin Chirvasuta
2016-08-12 15:20 ` James A. Robinson
2016-08-12 15:29   ` Costin Chirvasuta
2016-08-12 15:48     ` James A. Robinson [this message]
2016-08-12 16:10       ` Costin Chirvasuta
2016-08-12 16:16         ` James A. Robinson
2016-08-12 16:25           ` Costin Chirvasuta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPd04b5+aikz7uK9VpjzxWaf58MgkT0WbDnSBZ37L_RKLyD5Ow@mail.gmail.com \
    --to=jim.robinson@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).