Skip to content

Commit d607e0e

Browse files
committed
kconfig: change some expr_*() functions to bool
This clarifies the behavior of these functions. Signed-off-by: Masahiro Yamada <[email protected]>
1 parent a16219b commit d607e0e

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

scripts/kconfig/expr.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,10 @@ void expr_eliminate_eq(struct expr **ep1, struct expr **ep2)
243243
* equals some operand in the other (operands do not need to appear in the same
244244
* order), recursively.
245245
*/
246-
int expr_eq(struct expr *e1, struct expr *e2)
246+
bool expr_eq(struct expr *e1, struct expr *e2)
247247
{
248-
int res, old_count;
248+
int old_count;
249+
bool res;
249250

250251
/*
251252
* 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)
255256
return expr_is_yes(e1) && expr_is_yes(e2);
256257

257258
if (e1->type != e2->type)
258-
return 0;
259+
return false;
259260
switch (e1->type) {
260261
case E_EQUAL:
261262
case E_GEQ:
@@ -292,7 +293,7 @@ int expr_eq(struct expr *e1, struct expr *e2)
292293
printf(" ?\n");
293294
}
294295

295-
return 0;
296+
return false;
296297
}
297298

298299
/*
@@ -804,10 +805,10 @@ struct expr *expr_transform(struct expr *e)
804805
return e;
805806
}
806807

807-
int expr_contains_symbol(struct expr *dep, struct symbol *sym)
808+
bool expr_contains_symbol(struct expr *dep, struct symbol *sym)
808809
{
809810
if (!dep)
810-
return 0;
811+
return false;
811812

812813
switch (dep->type) {
813814
case E_AND:
@@ -829,7 +830,7 @@ int expr_contains_symbol(struct expr *dep, struct symbol *sym)
829830
default:
830831
;
831832
}
832-
return 0;
833+
return false;
833834
}
834835

835836
bool expr_depends_symbol(struct expr *dep, struct symbol *sym)

scripts/kconfig/expr.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,11 @@ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
278278
struct expr *expr_copy(const struct expr *org);
279279
void expr_free(struct expr *e);
280280
void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
281-
int expr_eq(struct expr *e1, struct expr *e2);
281+
bool expr_eq(struct expr *e1, struct expr *e2);
282282
tristate expr_calc_value(struct expr *e);
283283
struct expr *expr_eliminate_dups(struct expr *e);
284284
struct expr *expr_transform(struct expr *e);
285-
int expr_contains_symbol(struct expr *dep, struct symbol *sym);
285+
bool expr_contains_symbol(struct expr *dep, struct symbol *sym);
286286
bool expr_depends_symbol(struct expr *dep, struct symbol *sym);
287287
struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
288288

@@ -292,7 +292,7 @@ void expr_gstr_print(const struct expr *e, struct gstr *gs);
292292
void expr_gstr_print_revdep(struct expr *e, struct gstr *gs,
293293
tristate pr_type, const char *title);
294294

295-
static inline int expr_is_yes(const struct expr *e)
295+
static inline bool expr_is_yes(const struct expr *e)
296296
{
297297
return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes);
298298
}

0 commit comments

Comments
 (0)