From f75ab6d2c11e8a8e18191b087564aedebbeb96c5 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 11 Apr 2016 13:00:33 +0200 Subject: Imported Upstream version 1.0.3 --- CheckItem.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'CheckItem.c') 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; -- cgit v1.2.3