diff options
author | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:20 +0200 |
---|---|---|
committer | Daniel Lange <DLange@git.local> | 2016-04-11 13:00:20 +0200 |
commit | 85bb4ad9cb820ac3b8e935a930084a06cbfd2847 (patch) | |
tree | 681fd9b2d9fa80931b2a8bec4bb6667865b7c569 /Object.c | |
parent | ea859f50d9438bc61ae96721a4d255b49de78653 (diff) | |
download | debian_htop-85bb4ad9cb820ac3b8e935a930084a06cbfd2847.tar.gz debian_htop-85bb4ad9cb820ac3b8e935a930084a06cbfd2847.tar.bz2 debian_htop-85bb4ad9cb820ac3b8e935a930084a06cbfd2847.zip |
Imported Upstream version 0.6.3upstream/0.6.3
Diffstat (limited to 'Object.c')
-rw-r--r-- | Object.c | 35 |
1 files changed, 16 insertions, 19 deletions
@@ -15,38 +15,37 @@ in the source distribution for its full text. #include "debug.h" /*{ + +#ifndef DEBUG +#define Object_setClass(obj, class) +#endif + typedef struct Object_ Object; typedef void(*Object_Display)(Object*, RichString*); -typedef int(*Object_Compare)(const Object*, const Object*); +typedef int(*Object_Compare)(const void*, const void*); typedef void(*Object_Delete)(Object*); struct Object_ { + #ifdef DEBUG char* class; + #endif Object_Display display; - Object_Compare compare; Object_Delete delete; }; }*/ -/* private property */ +#ifdef DEBUG char* OBJECT_CLASS = "Object"; -void Object_new() { - Object* this; - this = malloc(sizeof(Object)); - this->class = OBJECT_CLASS; - this->display = Object_display; - this->compare = Object_compare; - this->delete = Object_delete; -} +#else +#define OBJECT_CLASS NULL +#endif -bool Object_instanceOf(Object* this, char* class) { - return this->class == class; -} +#ifdef DEBUG -void Object_delete(Object* this) { - free(this); +void Object_setClass(void* this, char* class) { + ((Object*)this)->class = class; } void Object_display(Object* this, RichString* out) { @@ -55,6 +54,4 @@ void Object_display(Object* this, RichString* out) { RichString_write(out, CRT_colors[DEFAULT_COLOR], objAddress); } -int Object_compare(const Object* this, const Object* o) { - return (this - o); -} +#endif |