mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Changes in object model: separate class objects to store vtable. Also, nicer UTF-8 display of big numbers.
This commit is contained in:
17
Process.c
17
Process.c
@ -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;
|
||||
|
Reference in New Issue
Block a user