MCPcopy Create free account
hub / github.com/Entware/Entware / sym_choice_default

Function sym_choice_default

scripts/config/symbol.c:244–268  ·  view source on GitHub ↗

* Find the default symbol for a choice. * First try the default values for the choice symbol * Next locate the first visible choice value * Return NULL if none was found */

Source from the content-addressed store, hash-verified

242 * Return NULL if none was found
243 */
244struct symbol *sym_choice_default(struct symbol *sym)
245{
246 struct symbol *def_sym;
247 struct property *prop;
248 struct expr *e;
249
250 /* any of the defaults visible? */
251 for_all_defaults(sym, prop) {
252 prop->visible.tri = expr_calc_value(prop->visible.expr);
253 if (prop->visible.tri == no)
254 continue;
255 def_sym = prop_get_symbol(prop);
256 if (def_sym->visible != no)
257 return def_sym;
258 }
259
260 /* just get the first visible value */
261 prop = sym_get_choice_prop(sym);
262 expr_list_for_each_sym(prop->expr, e, def_sym)
263 if (def_sym->visible != no)
264 return def_sym;
265
266 /* failed to locate any defaults */
267 return NULL;
268}
269
270static struct symbol *sym_calc_choice(struct symbol *sym)
271{

Callers 2

sym_calc_choiceFunction · 0.85
conf_write_defconfigFunction · 0.85

Calls 3

expr_calc_valueFunction · 0.85
prop_get_symbolFunction · 0.85
sym_get_choice_propFunction · 0.85

Tested by

no test coverage detected