emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/dismal 5a99007: * heaps.el (heap-insert): Fix thinko in


From: Stefan Monnier
Subject: [elpa] externals/dismal 5a99007: * heaps.el (heap-insert): Fix thinko in last change
Date: Thu, 20 May 2021 18:47:21 -0400 (EDT)

branch: externals/dismal
commit 5a9900796dca7a16c2c68364f7fabb6a55450789
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * heaps.el (heap-insert): Fix thinko in last change
---
 heaps.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/heaps.el b/heaps.el
index 42b1c49..29eb10f 100644
--- a/heaps.el
+++ b/heaps.el
@@ -1,6 +1,6 @@
 ;;; heaps.el --- Some kind of heap data structure of Dismal
 
-;; Copyright (C) 1992, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2021  Free Software Foundation, Inc.
 
 ;; Author: David Fox, fox@cs.nyu.edu
 ;; Created-On: Mon Jan  6 14:19:10 1992
@@ -117,8 +117,9 @@ Argument H "
     ;; Put the new element in the next free position in the heap vector
     (heap-aset heap (heap-last heap) element)
     ;; Increment the element count
-    (if (> index 0)
-        (heap--bubble-up heap (heap-last heap)))
+    (let ((last (heap-last heap)))
+      (if (> last 0)
+          (heap--bubble-up heap last)))
     (heap-set-last heap (1+ (heap-last heap)))))
 
 (defun heap-deletemin (heap)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]