summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2010-06-22 11:19:40 -0400
committerSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2010-06-22 11:22:31 -0400
commita805439f6443fb0e00ac6caff92f99950c1ddda8 (patch)
treeee20036421071320d076688a7529db84787e8ef4
parentdfab4600877ee79c6ff004e88f331ff300ba2ad7 (diff)
downloadscreen-a805439f6443fb0e00ac6caff92f99950c1ddda8.tar.gz
Fix layout ordering.
Layouts were being stored in a reversed list. This makes it confusing for both users and developers with regards to what the next layout is ('next', lay_next). So store the layouts in a properly ordered list in order to avoid the confusion. This closes savannah #29800.
-rw-r--r--src/layout.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/layout.c b/src/layout.c
index 6100b5d..196d10b 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -64,7 +64,7 @@ CreateLayout(title, startat)
char *title;
int startat;
{
- struct layout *lay;
+ struct layout *lay, **pl;
int i;
if (startat >= MAXLAY || startat < 0)
@@ -86,8 +86,12 @@ int startat;
lay->lay_autosave = 1;
lay->lay_number = i;
laytab[i] = lay;
- lay->lay_next = layouts;
- layouts = lay;
+ lay->lay_next = 0;
+
+ pl = &layouts;
+ while (*pl)
+ pl = &(*pl)->lay_next;
+ *pl = lay;
return lay;
}