aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorPaul Eggert2015-04-14 00:26:18 -0700
committerPaul Eggert2015-04-14 00:26:46 -0700
commit7744cc7e95bcae1df6911be5a9a941d73ea207f7 (patch)
treebc8fb8823fd321d97afef659a203be63b855450b /src/window.c
parentb80c5ebc4f6afd54597012583c6a1390db0ade9c (diff)
downloademacs-7744cc7e95bcae1df6911be5a9a941d73ea207f7.tar.gz
emacs-7744cc7e95bcae1df6911be5a9a941d73ea207f7.zip
Fix think-o in previous patch
* src/window.c (count_windows, get_leaf_windows): Don't optimize count_windows incorrectly.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/window.c b/src/window.c
index 461bb627df7..0fcf82d43f4 100644
--- a/src/window.c
+++ b/src/window.c
@@ -6527,11 +6527,17 @@ delete_all_child_windows (Lisp_Object window)
6527static ptrdiff_t 6527static ptrdiff_t
6528count_windows (struct window *window) 6528count_windows (struct window *window)
6529{ 6529{
6530 return get_leaf_windows (window, NULL, 0); 6530 ptrdiff_t count = 1;
6531 if (!NILP (window->next))
6532 count += count_windows (XWINDOW (window->next));
6533 if (WINDOWP (window->contents))
6534 count += count_windows (XWINDOW (window->contents));
6535 return count;
6531} 6536}
6532 6537
6533/* If vector FLAT is non-null, fill it with leaf windows under W, 6538
6534 starting at index I. Value is last index + 1. */ 6539/* Fill vector FLAT with leaf windows under W, starting at index I.
6540 Value is last index + 1. */
6535static ptrdiff_t 6541static ptrdiff_t
6536get_leaf_windows (struct window *w, struct window **flat, ptrdiff_t i) 6542get_leaf_windows (struct window *w, struct window **flat, ptrdiff_t i)
6537{ 6543{
@@ -6540,11 +6546,7 @@ get_leaf_windows (struct window *w, struct window **flat, ptrdiff_t i)
6540 if (WINDOWP (w->contents)) 6546 if (WINDOWP (w->contents))
6541 i = get_leaf_windows (XWINDOW (w->contents), flat, i); 6547 i = get_leaf_windows (XWINDOW (w->contents), flat, i);
6542 else 6548 else
6543 { 6549 flat[i++] = w;
6544 if (flat)
6545 flat[i] = w;
6546 i++;
6547 }
6548 6550
6549 w = NILP (w->next) ? 0 : XWINDOW (w->next); 6551 w = NILP (w->next) ? 0 : XWINDOW (w->next);
6550 } 6552 }