aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/confdata.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/confdata.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/confdata.c')
-rw-r--r--scripts/kconfig/confdata.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 2da4a8d775a5..54ca1a786d25 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -134,11 +134,11 @@ load:
134 case S_INT: 134 case S_INT:
135 case S_HEX: 135 case S_HEX:
136 case S_STRING: 136 case S_STRING:
137 if (sym->user.val) 137 if (sym->def[S_DEF_USER].val)
138 free(sym->user.val); 138 free(sym->def[S_DEF_USER].val);
139 default: 139 default:
140 sym->user.val = NULL; 140 sym->def[S_DEF_USER].val = NULL;
141 sym->user.tri = no; 141 sym->def[S_DEF_USER].tri = no;
142 } 142 }
143 } 143 }
144 144
@@ -166,7 +166,7 @@ load:
166 switch (sym->type) { 166 switch (sym->type) {
167 case S_BOOLEAN: 167 case S_BOOLEAN:
168 case S_TRISTATE: 168 case S_TRISTATE:
169 sym->user.tri = no; 169 sym->def[S_DEF_USER].tri = no;
170 sym->flags &= ~SYMBOL_NEW; 170 sym->flags &= ~SYMBOL_NEW;
171 break; 171 break;
172 default: 172 default:
@@ -196,18 +196,18 @@ load:
196 switch (sym->type) { 196 switch (sym->type) {
197 case S_TRISTATE: 197 case S_TRISTATE:
198 if (p[0] == 'm') { 198 if (p[0] == 'm') {
199 sym->user.tri = mod; 199 sym->def[S_DEF_USER].tri = mod;
200 sym->flags &= ~SYMBOL_NEW; 200 sym->flags &= ~SYMBOL_NEW;
201 break; 201 break;
202 } 202 }
203 case S_BOOLEAN: 203 case S_BOOLEAN:
204 if (p[0] == 'y') { 204 if (p[0] == 'y') {
205 sym->user.tri = yes; 205 sym->def[S_DEF_USER].tri = yes;
206 sym->flags &= ~SYMBOL_NEW; 206 sym->flags &= ~SYMBOL_NEW;
207 break; 207 break;
208 } 208 }
209 if (p[0] == 'n') { 209 if (p[0] == 'n') {
210 sym->user.tri = no; 210 sym->def[S_DEF_USER].tri = no;
211 sym->flags &= ~SYMBOL_NEW; 211 sym->flags &= ~SYMBOL_NEW;
212 break; 212 break;
213 } 213 }
@@ -230,7 +230,7 @@ load:
230 case S_INT: 230 case S_INT:
231 case S_HEX: 231 case S_HEX:
232 if (sym_string_valid(sym, p)) { 232 if (sym_string_valid(sym, p)) {
233 sym->user.val = strdup(p); 233 sym->def[S_DEF_USER].val = strdup(p);
234 sym->flags &= ~SYMBOL_NEW; 234 sym->flags &= ~SYMBOL_NEW;
235 } else { 235 } else {
236 conf_warning("symbol value '%s' invalid for %s", p, sym->name); 236 conf_warning("symbol value '%s' invalid for %s", p, sym->name);
@@ -249,24 +249,24 @@ load:
249 } 249 }
250 if (sym && sym_is_choice_value(sym)) { 250 if (sym && sym_is_choice_value(sym)) {
251 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); 251 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
252 switch (sym->user.tri) { 252 switch (sym->def[S_DEF_USER].tri) {
253 case no: 253 case no:
254 break; 254 break;
255 case mod: 255 case mod:
256 if (cs->user.tri == yes) { 256 if (cs->def[S_DEF_USER].tri == yes) {
257 conf_warning("%s creates inconsistent choice state", sym->name); 257 conf_warning("%s creates inconsistent choice state", sym->name);
258 cs->flags |= SYMBOL_NEW; 258 cs->flags |= SYMBOL_NEW;
259 } 259 }
260 break; 260 break;
261 case yes: 261 case yes:
262 if (cs->user.tri != no) { 262 if (cs->def[S_DEF_USER].tri != no) {
263 conf_warning("%s creates inconsistent choice state", sym->name); 263 conf_warning("%s creates inconsistent choice state", sym->name);
264 cs->flags |= SYMBOL_NEW; 264 cs->flags |= SYMBOL_NEW;
265 } else 265 } else
266 cs->user.val = sym; 266 cs->def[S_DEF_USER].val = sym;
267 break; 267 break;
268 } 268 }
269 cs->user.tri = E_OR(cs->user.tri, sym->user.tri); 269 cs->def[S_DEF_USER].tri = E_OR(cs->def[S_DEF_USER].tri, sym->def[S_DEF_USER].tri);
270 } 270 }
271 } 271 }
272 fclose(in); 272 fclose(in);
@@ -297,12 +297,12 @@ int conf_read(const char *name)
297 switch (sym->type) { 297 switch (sym->type) {
298 case S_BOOLEAN: 298 case S_BOOLEAN:
299 case S_TRISTATE: 299 case S_TRISTATE:
300 if (sym->user.tri != sym_get_tristate_value(sym)) 300 if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym))
301 break; 301 break;
302 if (!sym_is_choice(sym)) 302 if (!sym_is_choice(sym))
303 goto sym_ok; 303 goto sym_ok;
304 default: 304 default:
305 if (!strcmp(sym->curr.val, sym->user.val)) 305 if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val))
306 goto sym_ok; 306 goto sym_ok;
307 break; 307 break;
308 } 308 }
@@ -319,7 +319,7 @@ int conf_read(const char *name)
319 case S_STRING: 319 case S_STRING:
320 case S_INT: 320 case S_INT:
321 case S_HEX: 321 case S_HEX:
322 if (!sym_string_within_range(sym, sym->user.val)) { 322 if (!sym_string_within_range(sym, sym->def[S_DEF_USER].val)) {
323 sym->flags |= SYMBOL_NEW; 323 sym->flags |= SYMBOL_NEW;
324 sym->flags &= ~SYMBOL_VALID; 324 sym->flags &= ~SYMBOL_VALID;
325 } 325 }