diff options
author | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:33 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:33 +0200 |
commit | f75ab6d2c11e8a8e18191b087564aedebbeb96c5 (patch) | |
tree | 2a046e11678e798f3f9c7f7af4f9ac205c8d2731 /CheckItem.c | |
parent | 2004bbc3ef28ada3acca05f5d5fa9108121a6784 (diff) | |
download | debian_htop-f75ab6d2c11e8a8e18191b087564aedebbeb96c5.tar.gz debian_htop-f75ab6d2c11e8a8e18191b087564aedebbeb96c5.tar.bz2 debian_htop-f75ab6d2c11e8a8e18191b087564aedebbeb96c5.zip |
Imported Upstream version 1.0.3upstream/1.0.3
Diffstat (limited to 'CheckItem.c')
-rw-r--r-- | CheckItem.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/CheckItem.c b/CheckItem.c index 0fb40cf..ea83e6f 100644 --- a/CheckItem.c +++ b/CheckItem.c @@ -18,18 +18,12 @@ in the source distribution for its full text. typedef struct CheckItem_ { Object super; char* text; - bool value; bool* ref; + bool value; } CheckItem; }*/ -#ifdef DEBUG -char* CHECKITEM_CLASS = "CheckItem"; -#else -#define CHECKITEM_CLASS NULL -#endif - static void CheckItem_delete(Object* cast) { CheckItem* this = (CheckItem*)cast; assert (this != NULL); @@ -50,11 +44,13 @@ static void CheckItem_display(Object* cast, RichString* out) { RichString_append(out, CRT_colors[CHECK_TEXT], this->text); } +ObjectClass CheckItem_class = { + .display = CheckItem_display, + .delete = CheckItem_delete +}; + CheckItem* CheckItem_new(char* text, bool* ref, bool value) { - CheckItem* this = malloc(sizeof(CheckItem)); - Object_setClass(this, CHECKITEM_CLASS); - ((Object*)this)->display = CheckItem_display; - ((Object*)this)->delete = CheckItem_delete; + CheckItem* this = AllocThis(CheckItem); this->text = text; this->value = value; this->ref = ref; |