diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2015-08-12 17:29:32 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2015-08-12 17:29:32 -0300 |
commit | 0ebe688d2462fe99faf3ec9ef4d36e33017a636c (patch) | |
tree | dbd58491ea4825bf624ef7c75ba1e475a6a46770 /CheckItem.c | |
parent | e1e3ffad19e3d1d14ba8f1e8e4628a7cd01c7af6 (diff) |
Avoid future confusions with how default values are set.
Diffstat (limited to 'CheckItem.c')
-rw-r--r-- | CheckItem.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/CheckItem.c b/CheckItem.c index ea83e6f3..b7ba6fec 100644 --- a/CheckItem.c +++ b/CheckItem.c @@ -49,14 +49,22 @@ ObjectClass CheckItem_class = { .delete = CheckItem_delete }; -CheckItem* CheckItem_new(char* text, bool* ref, bool value) { +CheckItem* CheckItem_newByRef(char* text, bool* ref) { CheckItem* this = AllocThis(CheckItem); this->text = text; - this->value = value; + this->value = false; this->ref = ref; return this; } +CheckItem* CheckItem_newByVal(char* text, bool value) { + CheckItem* this = AllocThis(CheckItem); + this->text = text; + this->value = value; + this->ref = NULL; + return this; +} + void CheckItem_set(CheckItem* this, bool value) { if (this->ref) *(this->ref) = value; |