Commit d607e0e7 authored by Masahiro Yamada's avatar Masahiro Yamada

kconfig: change some expr_*() functions to bool

This clarifies the behavior of these functions.
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent a16219bd
...@@ -243,9 +243,10 @@ void expr_eliminate_eq(struct expr **ep1, struct expr **ep2) ...@@ -243,9 +243,10 @@ void expr_eliminate_eq(struct expr **ep1, struct expr **ep2)
* equals some operand in the other (operands do not need to appear in the same * equals some operand in the other (operands do not need to appear in the same
* order), recursively. * order), recursively.
*/ */
int expr_eq(struct expr *e1, struct expr *e2) bool expr_eq(struct expr *e1, struct expr *e2)
{ {
int res, old_count; int old_count;
bool res;
/* /*
* A NULL expr is taken to be yes, but there's also a different way to * A NULL expr is taken to be yes, but there's also a different way to
...@@ -255,7 +256,7 @@ int expr_eq(struct expr *e1, struct expr *e2) ...@@ -255,7 +256,7 @@ int expr_eq(struct expr *e1, struct expr *e2)
return expr_is_yes(e1) && expr_is_yes(e2); return expr_is_yes(e1) && expr_is_yes(e2);
if (e1->type != e2->type) if (e1->type != e2->type)
return 0; return false;
switch (e1->type) { switch (e1->type) {
case E_EQUAL: case E_EQUAL:
case E_GEQ: case E_GEQ:
...@@ -292,7 +293,7 @@ int expr_eq(struct expr *e1, struct expr *e2) ...@@ -292,7 +293,7 @@ int expr_eq(struct expr *e1, struct expr *e2)
printf(" ?\n"); printf(" ?\n");
} }
return 0; return false;
} }
/* /*
...@@ -804,10 +805,10 @@ struct expr *expr_transform(struct expr *e) ...@@ -804,10 +805,10 @@ struct expr *expr_transform(struct expr *e)
return e; return e;
} }
int expr_contains_symbol(struct expr *dep, struct symbol *sym) bool expr_contains_symbol(struct expr *dep, struct symbol *sym)
{ {
if (!dep) if (!dep)
return 0; return false;
switch (dep->type) { switch (dep->type) {
case E_AND: case E_AND:
...@@ -829,7 +830,7 @@ int expr_contains_symbol(struct expr *dep, struct symbol *sym) ...@@ -829,7 +830,7 @@ int expr_contains_symbol(struct expr *dep, struct symbol *sym)
default: default:
; ;
} }
return 0; return false;
} }
bool expr_depends_symbol(struct expr *dep, struct symbol *sym) bool expr_depends_symbol(struct expr *dep, struct symbol *sym)
......
...@@ -278,11 +278,11 @@ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2); ...@@ -278,11 +278,11 @@ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
struct expr *expr_copy(const struct expr *org); struct expr *expr_copy(const struct expr *org);
void expr_free(struct expr *e); void expr_free(struct expr *e);
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2); void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
int expr_eq(struct expr *e1, struct expr *e2); bool expr_eq(struct expr *e1, struct expr *e2);
tristate expr_calc_value(struct expr *e); tristate expr_calc_value(struct expr *e);
struct expr *expr_eliminate_dups(struct expr *e); struct expr *expr_eliminate_dups(struct expr *e);
struct expr *expr_transform(struct expr *e); struct expr *expr_transform(struct expr *e);
int expr_contains_symbol(struct expr *dep, struct symbol *sym); bool expr_contains_symbol(struct expr *dep, struct symbol *sym);
bool expr_depends_symbol(struct expr *dep, struct symbol *sym); bool expr_depends_symbol(struct expr *dep, struct symbol *sym);
struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym); struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
...@@ -292,7 +292,7 @@ void expr_gstr_print(const struct expr *e, struct gstr *gs); ...@@ -292,7 +292,7 @@ void expr_gstr_print(const struct expr *e, struct gstr *gs);
void expr_gstr_print_revdep(struct expr *e, struct gstr *gs, void expr_gstr_print_revdep(struct expr *e, struct gstr *gs,
tristate pr_type, const char *title); tristate pr_type, const char *title);
static inline int expr_is_yes(const struct expr *e) static inline bool expr_is_yes(const struct expr *e)
{ {
return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes); return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment