aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2022-03-31 02:01:31 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2022-03-31 02:01:31 +0300
commit4665a620775da64ec7280762979a9fc6fa37c0bc (patch)
tree6b8818b11548c164eccdd144f0e74781b955cb2b /include
parent5725085e3be9ee005c9b9cc4623d5ad5f90418f2 (diff)
downloadroscha-4665a620775da64ec7280762979a9fc6fa37c0bc.tar.gz
roscha-4665a620775da64ec7280762979a9fc6fa37c0bc.zip
Switch boolean type to uintptr_t
Dumb me, of course boolean could overflow and result in a false (0) case even if there was something.
Diffstat (limited to 'include')
-rw-r--r--include/object.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/object.h b/include/object.h
index 157ac0a..71fc969 100644
--- a/include/object.h
+++ b/include/object.h
@@ -35,8 +35,12 @@ struct roscha_object {
enum roscha_type type;
size_t refcount;
union {
- /* booleans are only used internally */
- bool boolean;
+ /*
+ * booleans are only used internally. It's not a bool so that we can
+ * evaluate as truthy objects such as integers and the other types
+ * without overflow problems of bool.
+ */
+ uintptr_t boolean;
/* integer numbers */
int64_t integer;
/* A dynamic string using the sds library */