Commit a72ab054 authored by Peter Korsgaard's avatar Peter Korsgaard
Browse files

package/config: rebase against 2.6.38-rc3



Fixes nconfig crash on comments within choice groups.

Signed-off-by: default avatarPeter Korsgaard <jacmet@sunsite.dk>
parent a538d405
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -528,8 +528,6 @@ int main(int ac, char **av)
		}
		break;
	case savedefconfig:
		conf_read(NULL);
		break;
	case silentoldconfig:
	case oldaskconfig:
	case oldconfig:
+8 −16
Original line number Diff line number Diff line
@@ -439,12 +439,11 @@ static void conf_write_string(bool headerfile, const char *name,
	fputs("\"\n", out);
}

static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
                              FILE *out, bool write_no)
static void conf_write_symbol(struct symbol *sym, FILE *out, bool write_no)
{
	const char *str;

	switch (type) {
	switch (sym->type) {
	case S_BOOLEAN:
	case S_TRISTATE:
		switch (sym_get_tristate_value(sym)) {
@@ -531,7 +530,7 @@ int conf_write_defconfig(const char *filename)
						goto next_menu;
				}
			}
			conf_write_symbol(sym, sym->type, out, true);
			conf_write_symbol(sym, out, true);
		}
next_menu:
		if (menu->list != NULL) {
@@ -560,7 +559,6 @@ int conf_write(const char *name)
	const char *basename;
	const char *str;
	char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
	enum symbol_type type;
	time_t now;
	int use_timestamp = 1;
	char *env;
@@ -635,14 +633,8 @@ int conf_write(const char *name)
			if (!(sym->flags & SYMBOL_WRITE))
				goto next;
			sym->flags &= ~SYMBOL_WRITE;
			type = sym->type;
			if (type == S_TRISTATE) {
				sym_calc_value(modules_sym);
				if (modules_sym->curr.tri == no)
					type = S_BOOLEAN;
			}
			/* Write config symbol to file */
			conf_write_symbol(sym, type, out, true);
			conf_write_symbol(sym, out, true);
		}

next:
@@ -872,7 +864,7 @@ int conf_write_autoconf(void)
			continue;

		/* write symbol to config file */
		conf_write_symbol(sym, sym->type, out, false);
		conf_write_symbol(sym, out, false);

		/* update autoconf and tristate files */
		switch (sym->type) {
@@ -978,7 +970,7 @@ static void randomize_choice_values(struct symbol *csym)
	int cnt, def;

	/*
	 * If choice is mod then we may have more items slected
	 * If choice is mod then we may have more items selected
	 * and if no then no-one.
	 * In both cases stop.
	 */
@@ -1090,10 +1082,10 @@ void conf_set_all_new_symbols(enum conf_def_mode mode)

	/*
	 * We have different type of choice blocks.
	 * If curr.tri equal to mod then we can select several
	 * If curr.tri equals to mod then we can select several
	 * choice symbols in one block.
	 * In this case we do nothing.
	 * If curr.tri equal yes then only one symbol can be
	 * If curr.tri equals yes then only one symbol can be
	 * selected in a choice block and we set it to yes,
	 * and the rest to no.
	 */
+43 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2)
	return e2 ? expr_alloc_two(E_OR, e1, e2) : e1;
}

struct expr *expr_copy(struct expr *org)
struct expr *expr_copy(const struct expr *org)
{
	struct expr *e;

@@ -1013,6 +1013,48 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2)
#endif
}

static inline struct expr *
expr_get_leftmost_symbol(const struct expr *e)
{

	if (e == NULL)
		return NULL;

	while (e->type != E_SYMBOL)
		e = e->left.expr;

	return expr_copy(e);
}

/*
 * Given expression `e1' and `e2', returns the leaf of the longest
 * sub-expression of `e1' not containing 'e2.
 */
struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2)
{
	struct expr *ret;

	switch (e1->type) {
	case E_OR:
		return expr_alloc_and(
		    expr_simplify_unmet_dep(e1->left.expr, e2),
		    expr_simplify_unmet_dep(e1->right.expr, e2));
	case E_AND: {
		struct expr *e;
		e = expr_alloc_and(expr_copy(e1), expr_copy(e2));
		e = expr_eliminate_dups(e);
		ret = (!expr_eq(e, e1)) ? e1 : NULL;
		expr_free(e);
		break;
		}
	default:
		ret = e1;
		break;
	}

	return expr_get_leftmost_symbol(ret);
}

void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)
{
	if (!e) {
+2 −1
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e
struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2);
struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
struct expr *expr_copy(struct expr *org);
struct expr *expr_copy(const struct expr *org);
void expr_free(struct expr *e);
int expr_eq(struct expr *e1, struct expr *e2);
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
@@ -207,6 +207,7 @@ struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2);
struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2);
void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2);
struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2);

void expr_fprint(struct expr *e, FILE *out);
struct gstr; /* forward */
+5 −2
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
static inline const char *gettext(const char *txt) { return txt; }
static inline void textdomain(const char *domainname) {}
static inline void bindtextdomain(const char *name, const char *dir) {}
static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; }
#endif

#ifdef __cplusplus
@@ -67,10 +68,12 @@ struct kconf_id {
	enum symbol_type stype;
};

#ifdef YYDEBUG
extern int zconfdebug;
#endif

int zconfparse(void);
void zconfdump(FILE *out);

extern int zconfdebug;
void zconf_starthelp(void);
FILE *zconf_fopen(const char *name);
void zconf_initscan(const char *name);
Loading