diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2012-12-05 15:12:20 +0000 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2012-12-05 15:12:20 +0000 |
commit | 00b324bfc162030b575e03795dcfcaac56bd0b4d (patch) | |
tree | fbaada243839b0b67351856e2d02a2e8184bf65f /Process.c | |
parent | 2a73405cd060b543d56987650327b18078a137d7 (diff) |
Changes in object model: separate class objects to store vtable. Also, nicer UTF-8 display of big numbers.
Diffstat (limited to 'Process.c')
-rw-r--r-- | Process.c | 17 |
1 files changed, 8 insertions, 9 deletions
@@ -175,12 +175,6 @@ typedef struct Process_ { }*/ -#ifdef DEBUG -char* PROCESS_CLASS = "Process"; -#else -#define PROCESS_CLASS NULL -#endif - const char *Process_fieldNames[] = { "", "PID", "Command", "STATE", "PPID", "PGRP", "SESSION", "TTY_NR", "TPGID", "FLAGS", "MINFLT", "CMINFLT", "MAJFLT", "CMAJFLT", @@ -564,11 +558,16 @@ void Process_delete(Object* cast) { free(this); } +ObjectClass Process_class = { + .extends = Class(Object), + .display = Process_display, + .delete = Process_delete, + .compare = Process_compare +}; + Process* Process_new(struct ProcessList_ *pl) { Process* this = calloc(sizeof(Process), 1); - Object_setClass(this, PROCESS_CLASS); - ((Object*)this)->display = Process_display; - ((Object*)this)->delete = Process_delete; + Object_setClass(this, Class(Process)); this->pid = 0; this->pl = pl; this->tag = false; |