mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Ed Schouten <ed@nuxi.nl>
To: Ed Schouten <ed@nuxi.nl>, musl@lists.openwall.com
Subject: Re: tdelete() may break the AVL tree balance property?
Date: Sat, 5 Dec 2015 08:42:38 +0100	[thread overview]
Message-ID: <CABh_MKkP+AC2wr=StEvtHXQarV7n1YzL+bb4UWimDDmPCHiygg@mail.gmail.com> (raw)
In-Reply-To: <20151205031933.GT23362@port70.net>

Hi Szabolcs,

2015-12-05 4:19 GMT+01:00 Szabolcs Nagy <nsz@port70.net>:
> thanks for the report
> yes it's wrong (this code is from me)
> i attached a fix, but i'll have to
> look at it again tomorrow in case
> there is a better approach.

Though I haven't tested the patch personally, I think that is the
correct way to solve it indeed.

By the way, it should be possible to easily detect these kinds of
imbalances by looking at the value by delta(). It should always be
between [-2, +2]. I don't know what musl's policy on assertions is,
but it may be worth adding such a check to prevent this from
regressing.

Thanks,
-- 
Ed Schouten <ed@nuxi.nl>
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717


      reply	other threads:[~2015-12-05  7:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-04 22:55 Ed Schouten
2015-12-05  3:19 ` Szabolcs Nagy
2015-12-05  7:42   ` Ed Schouten [this message]

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='CABh_MKkP+AC2wr=StEvtHXQarV7n1YzL+bb4UWimDDmPCHiygg@mail.gmail.com' \
    --to=ed@nuxi.nl \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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).