emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 7744cc7: Fix think-o in previous patch


From: Paul Eggert
Subject: [Emacs-diffs] master 7744cc7: Fix think-o in previous patch
Date: Tue, 14 Apr 2015 07:27:06 +0000

branch: master
commit 7744cc7e95bcae1df6911be5a9a941d73ea207f7
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Fix think-o in previous patch
    
    * src/window.c (count_windows, get_leaf_windows):
    Don't optimize count_windows incorrectly.
---
 src/window.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/window.c b/src/window.c
index 461bb62..0fcf82d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -6527,11 +6527,17 @@ delete_all_child_windows (Lisp_Object window)
 static ptrdiff_t
 count_windows (struct window *window)
 {
-  return get_leaf_windows (window, NULL, 0);
+  ptrdiff_t count = 1;
+  if (!NILP (window->next))
+    count += count_windows (XWINDOW (window->next));
+  if (WINDOWP (window->contents))
+    count += count_windows (XWINDOW (window->contents));
+  return count;
 }
 
-/* If vector FLAT is non-null, fill it with leaf windows under W,
-   starting at index I.  Value is last index + 1.  */
+
+/* Fill vector FLAT with leaf windows under W, starting at index I.
+   Value is last index + 1.  */
 static ptrdiff_t
 get_leaf_windows (struct window *w, struct window **flat, ptrdiff_t i)
 {
@@ -6540,11 +6546,7 @@ get_leaf_windows (struct window *w, struct window 
**flat, ptrdiff_t i)
       if (WINDOWP (w->contents))
        i = get_leaf_windows (XWINDOW (w->contents), flat, i);
       else
-       {
-         if (flat)
-           flat[i] = w;
-         i++;
-       }
+       flat[i++] = w;
 
       w = NILP (w->next) ? 0 : XWINDOW (w->next);
     }



reply via email to

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