From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: noverlay branch Date: Fri, 30 Sep 2022 07:20:49 +0200 Message-ID: References: <1468ca31-1703-82a1-0c8c-be2c5b5674a7@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14810"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin) Cc: emacs-devel@gnu.org, matt@rfc20.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Sep 30 07:22:21 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oe8Td-0003d2-97 for ged-emacs-devel@m.gmane-mx.org; Fri, 30 Sep 2022 07:22:21 +0200 Original-Received: from localhost ([::1]:35282 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oe8Tb-0002AQ-Kp for ged-emacs-devel@m.gmane-mx.org; Fri, 30 Sep 2022 01:22:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oe8SE-0001Re-LD for emacs-devel@gnu.org; Fri, 30 Sep 2022 01:20:54 -0400 Original-Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:43843) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oe8SD-0003xd-4D for emacs-devel@gnu.org; Fri, 30 Sep 2022 01:20:54 -0400 Original-Received: by mail-ed1-x529.google.com with SMTP id y8so4532614edc.10 for ; Thu, 29 Sep 2022 22:20:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date; bh=SFcT3fP4E0lqWnY6UN3FR7EXGs0tayNUM6MFhwCBci8=; b=i0vp4GpfT3U4QqoQhvzW6/xzaJYJ5HBl+Dbjue2Bj0nvVPuDmvfo4qTf9/rEM78HVx CrPWnNiAieV3ygJeB88uRg9wugUDvpo57zuYUL0Zst3aivi1FDhPAarquF9uKm8oo6Ak 3bpQnW3QKurdmskjwZRbjdGR73+Hh2JGd2Id0qdAdJeaGpu8SWgfvBMwKiJW6nITC9v9 9bp8p0nD6dnqYJWNLUmKPuzg4Sgn/0HsiLeSyvA3PXnbL83o1wOoSfKtuqVokH5T6Cep Uk+0exK+x9sYU10VypFVnt5st5ciorTS+yFRQ2Wa2zOAHLfezJpARUUGaAFOIMKYMrmY Sc+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date; bh=SFcT3fP4E0lqWnY6UN3FR7EXGs0tayNUM6MFhwCBci8=; b=72MHOdsqjveAn+uXxyxekEmf4/mUKxazIY2MNQyt1OhmGWgEzE6a5NCoK53uVBLQk1 A2S4KWyflLUmLPC9ECCtev02Dzrw+GdzLR6zwEpXJuc0/uew2HLLsix7u2bnzMrqZyxt 5NEF6CEZnF1Tu5yo0+yIov+EQi3MAUZ5lk24zS7VMeWEYg597h/nb88XduwI8VxoExlG S6tFrGDt5R4iL1dTmojj/NN2dhH4zGIXgWFXxMv5nnFG94hcIS8zQRmvx1Bzd34oFuPH +FOGOrWhdt0wLM9/nbo2UxX2nLfh07RKd9ryYhn3P/RGBDkZesuRkLwfFW43Qcre8/7F 4hPw== X-Gm-Message-State: ACrzQf2XYk4GhAgDTpSoW9X1I9yXvDzRH0fVyYNZfYeyqihFa6FAfeDA H1jETryRFBXmtZkRxZ+OJE4= X-Google-Smtp-Source: AMsMyM6OtAX07XeCRXBIjdtCMCO7NS5GiJedrbK1ASg8HHLVvo6B6cmE98wKpTzTlSo9/BlXseD6/g== X-Received: by 2002:a05:6402:3585:b0:451:57a1:98df with SMTP id y5-20020a056402358500b0045157a198dfmr6371311edc.356.1664515251330; Thu, 29 Sep 2022 22:20:51 -0700 (PDT) Original-Received: from Mini.fritz.box (pd9e36cee.dip0.t-ipconnect.de. [217.227.108.238]) by smtp.gmail.com with ESMTPSA id e5-20020a056402104500b004580862ffdbsm950954edu.59.2022.09.29.22.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 22:20:50 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Thu, 29 Sep 2022 17:36:09 -0400") Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=gerd.moellmann@gmail.com; helo=mail-ed1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:296492 Archived-At: Stefan Monnier writes: W>> If that's done for the same reason in itree.c, I don't know. A hint that it >> is not, might be that each tree has a separated null node... > > OTOH there's a single mem tree, so in a sense you also have a separate > mem_nil node per tree :-) Hehe, true :-). > I actually do understand the above use. What I don't understand is code > such as: > > interval_tree_remove (struct interval_tree *tree, struct interval_node *node) > { > struct interval_node *broken = NULL; > if (node->left == &tree->null || node->right == &tree->null) > { ... } > else > { > struct interval_node *min = interval_tree_subtree_min (tree, node->right); > struct interval_node *min_right = min->right; > > if (!min->red) > broken = min->right; > if (min->parent == node) > min_right->parent = min; /* set parent, if min_right = null */ > > where `min_right` on this last line can definitely be the null node (my > tests confirm it). Ok. > So what does it mean that we set the null nodes' `parent` field here? > How does it interact with other places where we use the `parent` field > (such as the last-but-one line where I confirmed that `min` can also be > the null node). Yes, that's odd, but it should be harmless. In general, walking the tree should always stop at null, and not proceed with null itself. So null->parent shouldn't matter. But it feels odd. I don't remember other rb-tree implementations doing that. Maybe it's something special to Corman's implementation? (Introduction to Algorithms was always quite expensive here, so I never bought it).