aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/symbol.c
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2006-06-09 01:12:41 -0400
committerSam Ravnborg <sam@mars.ravnborg.org>2006-06-09 01:31:30 -0400
commit0c1822e6991a10da6dc391f0a2e2cf5fb2e31238 (patch)
treef86393b38a29d7f5e3ef34b060e04fb34c283044 /scripts/kconfig/symbol.c
parentc0e150acde52e4661675539bf5323309270f2e83 (diff)
kconfig: allow multiple default values per symbol
Extend struct symbol to allow storing multiple default values, which can be used to hold multiple configurations. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts/kconfig/symbol.c')
-rw-r--r--scripts/kconfig/symbol.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index a0a467a4387b..4ea0050dcb16 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -227,7 +227,7 @@ static struct symbol *sym_calc_choice(struct symbol *sym)
227 struct expr *e; 227 struct expr *e;
228 228
229 /* is the user choice visible? */ 229 /* is the user choice visible? */
230 def_sym = sym->user.val; 230 def_sym = sym->def[S_DEF_USER].val;
231 if (def_sym) { 231 if (def_sym) {
232 sym_calc_visibility(def_sym); 232 sym_calc_visibility(def_sym);
233 if (def_sym->visible != no) 233 if (def_sym->visible != no)
@@ -306,7 +306,7 @@ void sym_calc_value(struct symbol *sym)
306 } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) { 306 } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) {
307 sym->flags |= SYMBOL_WRITE; 307 sym->flags |= SYMBOL_WRITE;
308 if (sym_has_value(sym)) 308 if (sym_has_value(sym))
309 newval.tri = sym->user.tri; 309 newval.tri = sym->def[S_DEF_USER].tri;
310 else if (!sym_is_choice(sym)) { 310 else if (!sym_is_choice(sym)) {
311 prop = sym_get_default_prop(sym); 311 prop = sym_get_default_prop(sym);
312 if (prop) 312 if (prop)
@@ -329,7 +329,7 @@ void sym_calc_value(struct symbol *sym)
329 if (sym->visible != no) { 329 if (sym->visible != no) {
330 sym->flags |= SYMBOL_WRITE; 330 sym->flags |= SYMBOL_WRITE;
331 if (sym_has_value(sym)) { 331 if (sym_has_value(sym)) {
332 newval.val = sym->user.val; 332 newval.val = sym->def[S_DEF_USER].val;
333 break; 333 break;
334 } 334 }
335 } 335 }
@@ -439,7 +439,7 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val)
439 struct property *prop; 439 struct property *prop;
440 struct expr *e; 440 struct expr *e;
441 441
442 cs->user.val = sym; 442 cs->def[S_DEF_USER].val = sym;
443 cs->flags &= ~SYMBOL_NEW; 443 cs->flags &= ~SYMBOL_NEW;
444 prop = sym_get_choice_prop(cs); 444 prop = sym_get_choice_prop(cs);
445 for (e = prop->expr; e; e = e->left.expr) { 445 for (e = prop->expr; e; e = e->left.expr) {
@@ -448,7 +448,7 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val)
448 } 448 }
449 } 449 }
450 450
451 sym->user.tri = val; 451 sym->def[S_DEF_USER].tri = val;
452 if (oldval != val) { 452 if (oldval != val) {
453 sym_clear_all_valid(); 453 sym_clear_all_valid();
454 if (sym == modules_sym) 454 if (sym == modules_sym)
@@ -596,15 +596,15 @@ bool sym_set_string_value(struct symbol *sym, const char *newval)
596 sym_set_changed(sym); 596 sym_set_changed(sym);
597 } 597 }
598 598
599 oldval = sym->user.val; 599 oldval = sym->def[S_DEF_USER].val;
600 size = strlen(newval) + 1; 600 size = strlen(newval) + 1;
601 if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { 601 if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) {
602 size += 2; 602 size += 2;
603 sym->user.val = val = malloc(size); 603 sym->def[S_DEF_USER].val = val = malloc(size);
604 *val++ = '0'; 604 *val++ = '0';
605 *val++ = 'x'; 605 *val++ = 'x';
606 } else if (!oldval || strcmp(oldval, newval)) 606 } else if (!oldval || strcmp(oldval, newval))
607 sym->user.val = val = malloc(size); 607 sym->def[S_DEF_USER].val = val = malloc(size);
608 else 608 else
609 return true; 609 return true;
610 610