aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_docmd.c
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-07-12 23:24:28 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-07-15 23:07:29 -0400
commite95945a1574327a025334c7ed285741ebdff4cd4 (patch)
tree56d9f1ebb27e2e89884175b9c52a41b423510da2 /src/nvim/ex_docmd.c
parent1c2cfdba88ce3a83807c3c38909c0ee6b3ec2df0 (diff)
downloadrneovim-e95945a1574327a025334c7ed285741ebdff4cd4.tar.gz
rneovim-e95945a1574327a025334c7ed285741ebdff4cd4.tar.bz2
rneovim-e95945a1574327a025334c7ed285741ebdff4cd4.zip
vim-patch:8.1.0623: iterating through window frames is repeated
Problem: Iterating through window frames is repeated. Solution: Define FOR_ALL_FRAMES. (Yegappan Lakshmanan) https://github.com/vim/vim/commit/3d1491ed2394b3e92902102879bace28a5f9c201
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r--src/nvim/ex_docmd.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 1d27cf338e..acd6db4d95 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -9323,26 +9323,30 @@ static frame_T *ses_skipframe(frame_T *fr)
{
frame_T *frc;
- for (frc = fr; frc != NULL; frc = frc->fr_next)
- if (ses_do_frame(frc))
+ FOR_ALL_FRAMES(frc, fr) {
+ if (ses_do_frame(frc)) {
break;
+ }
+ }
return frc;
}
-/*
- * Return TRUE if frame "fr" has a window somewhere that we want to save in
- * the Session.
- */
-static int ses_do_frame(frame_T *fr)
+// Return true if frame "fr" has a window somewhere that we want to save in
+// the Session.
+static bool ses_do_frame(const frame_T *fr)
+ FUNC_ATTR_NONNULL_ARG(1)
{
- frame_T *frc;
+ const frame_T *frc;
- if (fr->fr_layout == FR_LEAF)
+ if (fr->fr_layout == FR_LEAF) {
return ses_do_win(fr->fr_win);
- for (frc = fr->fr_child; frc != NULL; frc = frc->fr_next)
- if (ses_do_frame(frc))
- return TRUE;
- return FALSE;
+ }
+ FOR_ALL_FRAMES(frc, fr->fr_child) {
+ if (ses_do_frame(frc)) {
+ return true;
+ }
+ }
+ return false;
}
/// Return non-zero if window "wp" is to be stored in the Session.