GNU bug report logs - #46836
28.0.50; Clean up obsolete comment for unchain_marker

Previous Next

Package: emacs;

Reported by: Matt Armstrong <matt <at> rfc20.org>

Date: Sun, 28 Feb 2021 22:55:02 UTC

Severity: normal

Tags: fixed, patch

Found in version 28.0.50

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 46836 in the body.
You can then email your comments to 46836 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#46836; Package emacs. (Sun, 28 Feb 2021 22:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matt Armstrong <matt <at> rfc20.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 28 Feb 2021 22:55:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Matt Armstrong <matt <at> rfc20.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; Clean up obsolete comment for unchain_marker
Date: Sun, 28 Feb 2021 14:54:27 -0800
[Message part 1 (text/plain, inline)]
I wondered why there was a scare comment for unchain_marker, when the
code itself did not look like it was especially different from the other
nearby functions.  It turns out that the call into this function from GC
was removed a few years ago.

[0001-Clean-up-obsolete-comment.patch (text/x-patch, inline)]
From c03f9fc86ee79a995acae012cac07609ebaa3d5e Mon Sep 17 00:00:00 2001
From: Matt Armstrong <matt <at> rfc20.org>
Date: Sun, 28 Feb 2021 14:41:33 -0800
Subject: [PATCH] Clean up obsolete comment
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Commit cf3164523b (* src/alloc.c: Avoid O(N²) complexity when
unchaining markers (bug#24548)., 2018-03-23) removed the call from GC
into unchain_marker, so there is no need to warn about it.

* src/marker.c (unchain_marker): Clean up obsolete comment.
---
 src/marker.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/marker.c b/src/marker.c
index 5979151317..2b137b14c8 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -634,16 +634,15 @@ set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer,
 /* Detach a marker so that it no longer points anywhere and no longer
    slows down editing.  Do not free the marker, though, as a change
    function could have inserted it into an undo list (Bug#30931).  */
+
 void
 detach_marker (Lisp_Object marker)
 {
   Fset_marker (marker, Qnil, Qnil);
 }
 
-/* Remove MARKER from the chain of whatever buffer it is in,
-   leaving it points to nowhere.  This is called during garbage
-   collection, so we must be careful to ignore and preserve
-   mark bits, including those in chain fields of markers.  */
+/* Remove MARKER from the chain of whatever buffer it is in.  Set its
+   buffer NULL.  */
 
 void
 unchain_marker (register struct Lisp_Marker *marker)
-- 
2.30.0

[Message part 3 (text/plain, inline)]

In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin20.3.0, NS appkit-2022.30 Version 11.2.1 (Build 20D74))
 of 2021-02-27 built on matts-mbp-2016.lan
Repository revision: de33de1a660283f45a10acfaedef20c460553dbd
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2022
System Description:  macOS 11.2.2

Added tag(s) patch. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 01 Mar 2021 13:13:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46836; Package emacs. (Mon, 01 Mar 2021 13:31:01 GMT) Full text and rfc822 format available.

Message #10 received at 46836 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Matt Armstrong <matt <at> rfc20.org>
Cc: 46836 <at> debbugs.gnu.org
Subject: Re: bug#46836: 28.0.50; Clean up obsolete comment for unchain_marker
Date: Mon, 01 Mar 2021 14:29:49 +0100
Matt Armstrong <matt <at> rfc20.org> writes:

> I wondered why there was a scare comment for unchain_marker, when the
> code itself did not look like it was especially different from the other
> nearby functions.  It turns out that the call into this function from GC
> was removed a few years ago.

[...]

> -/* Remove MARKER from the chain of whatever buffer it is in,
> -   leaving it points to nowhere.  This is called during garbage
> -   collection, so we must be careful to ignore and preserve
> -   mark bits, including those in chain fields of markers.  */
> +/* Remove MARKER from the chain of whatever buffer it is in.  Set its
> +   buffer NULL.  */

Thanks; applied to Emacs 28.

Looking at the code in unchain_marker, I was a bit confused, because the
code looks very straightforward?  I wondered whether the function could
also be simplified now that it doesn't have to preserve mark bits...

But all the special mark bit code was removed from this code a couple
decades ago.  :-)

commit 5e097e002ba08205c8a4643b3495dbd45462147f
Author:     Stefan Monnier <monnier <at> iro.umontreal.ca>
AuthorDate: Thu Jun 26 23:17:50 2003 +0000

...

 	  else
-	    {
-	      omark = XMARKBIT (XMARKER (prev)->chain);
-	      XMARKER (prev)->chain = next;
-	      XSETMARKBIT (XMARKER (prev)->chain, omark);
-	    }


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 01 Mar 2021 13:31:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 46836 <at> debbugs.gnu.org and Matt Armstrong <matt <at> rfc20.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 01 Mar 2021 13:31:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 30 Mar 2021 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 27 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.