Move value_true to value.h

I noticed that value_true is declared in language.h and defined in
language.c.  However, as part of the value API, I think it would be
better in one of those files.  And, because it is very short, I
changed it to be an inline function in value.h.  I've also removed a
comment from the implementation, on the basis that it seems obsolete
-- if the change it suggests was needed, it probably would have been
done by now; and if it is needed in the future, odds are it would be
done differently anyway.

Finally, this patch also changes value_true and value_logical_not to
return a bool, and updates some uses.
This commit is contained in:
Tom Tromey
2021-08-26 18:17:40 -06:00
parent 604386598d
commit 7ebaa5f782
8 changed files with 20 additions and 34 deletions

View File

@ -1022,7 +1022,15 @@ extern int value_equal_contents (struct value *arg1, struct value *arg2);
extern int value_less (struct value *arg1, struct value *arg2);
extern int value_logical_not (struct value *arg1);
/* Simulate the C operator ! -- return true if ARG1 contains zero. */
extern bool value_logical_not (struct value *arg1);
/* Returns true if the value VAL represents a true value. */
static inline bool
value_true (struct value *val)
{
return !value_logical_not (val);
}
/* C++ */