aboutsummaryrefslogtreecommitdiff
path: root/scripts/permute/menudata.c
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-05-14 15:20:34 +0200
committerKarel Kočí <cynerd@email.cz>2015-05-14 15:20:34 +0200
commitcf271a82276a19917638de856a9d10f3b1ceb488 (patch)
treea7bad80c1300e0504cd69885269ac81b642c33f9 /scripts/permute/menudata.c
parent71ffeac967944bfd4f61d1f5724c8aed9d6d35a3 (diff)
downloadlinux-conf-perf-cf271a82276a19917638de856a9d10f3b1ceb488.tar.gz
linux-conf-perf-cf271a82276a19917638de856a9d10f3b1ceb488.tar.bz2
linux-conf-perf-cf271a82276a19917638de856a9d10f3b1ceb488.zip
Fix problems with permute
Permute should now reading and loading configurations right. In case of configuration change, forces save.
Diffstat (limited to 'scripts/permute/menudata.c')
-rw-r--r--scripts/permute/menudata.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/scripts/permute/menudata.c b/scripts/permute/menudata.c
index c941552..88910ab 100644
--- a/scripts/permute/menudata.c
+++ b/scripts/permute/menudata.c
@@ -8,11 +8,14 @@ struct menudata *menudata_new(void) {
void menudata_set_permute(struct menu *m, bool perm) {
((struct menudata *) m->data)->permute = perm;
- ((struct menudata *) m->data)->subpermute = perm;
struct menu *prnt;
- for (prnt = m->parent; prnt != NULL; prnt = prnt->parent) {
+ for (prnt = m; prnt != NULL; prnt = prnt->parent) {
menudata_cal(prnt);
}
+}
+
+void menudata_set_all_permute(struct menu *m, bool perm) {
+ menudata_set_permute(m, perm);
struct menu **stack;
size_t stack_size = 2, stack_pos = 0;
@@ -37,23 +40,19 @@ void menudata_set_permute(struct menu *m, bool perm) {
if (m == NULL && stack_pos > 0)
m = stack[--stack_pos];
}
+
}
void menudata_cal(struct menu *m) {
- bool perm = true;
bool subperm = false;
struct menu *w;
for (w = m->list; w != NULL; w = w->next) {
if (w->data != NULL && (((struct menudata *) w->data)->permute
|| ((struct menudata *) w->data)->
subpermute)) {
- subperm = true;
- } else {
- perm = false;
+ if (m->data == NULL)
+ m->data = menudata_new();
+ ((struct menudata *) m->data)->subpermute = subperm;
}
}
- if (m->data == NULL)
- m->data = menudata_new();
- ((struct menudata *) m->data)->permute = perm && subperm;
- ((struct menudata *) m->data)->subpermute = subperm;
}