diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2015-03-31 23:23:10 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2015-03-31 23:23:10 -0300 |
commit | 4c24a9b462e2e55e9d2f6d24694d5408c886c556 (patch) | |
tree | d5e7af57c59190bf5d35718d4c31c96546f2adf6 /linux/LinuxProcess.c | |
parent | 5320bab202aa5dad893a0da5848be1c40728d9e1 (diff) |
Fixes to subclassing Process.
Diffstat (limited to 'linux/LinuxProcess.c')
-rw-r--r-- | linux/LinuxProcess.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index b534d4da..269843a4 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -27,9 +27,19 @@ typedef struct LinuxProcess_ { }*/ +ProcessClass LinuxProcess_class = { + .super = { + .extends = Class(Process), + .display = Process_display, + .delete = Process_delete, + .compare = LinuxProcess_compare + }, + .writeField = (Process_WriteField) LinuxProcess_writeField, +}; + LinuxProcess* LinuxProcess_new(ProcessList* pl) { LinuxProcess* this = calloc(sizeof(LinuxProcess), 1); - Object_setClass(this, Class(Process)); + Object_setClass(this, Class(LinuxProcess)); Process_init(&this->super, pl); return this; } @@ -85,7 +95,8 @@ void LinuxProcess_writeField(LinuxProcess* this, RichString* str, ProcessField f break; } default: - snprintf(buffer, n, "- "); + Process_writeField((Process*)this, str, field); + return; } RichString_append(str, attr, buffer); } @@ -104,6 +115,6 @@ long LinuxProcess_compare(const void* v1, const void* v2) { case IO_PRIORITY: return LinuxProcess_effectiveIOPriority(p1) - LinuxProcess_effectiveIOPriority(p2); default: - return (p1->super.pid - p2->super.pid); + return Process_compare(v1, v2); } } |