summaryrefslogtreecommitdiffstats
path: root/ProcessList.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2012-12-05 15:12:20 +0000
committerHisham Muhammad <hisham@gobolinux.org>2012-12-05 15:12:20 +0000
commit00b324bfc162030b575e03795dcfcaac56bd0b4d (patch)
treefbaada243839b0b67351856e2d02a2e8184bf65f /ProcessList.c
parent2a73405cd060b543d56987650327b18078a137d7 (diff)
Changes in object model: separate class objects to store vtable. Also, nicer UTF-8 display of big numbers.
Diffstat (limited to 'ProcessList.c')
-rw-r--r--ProcessList.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/ProcessList.c b/ProcessList.c
index 0138919a..99a6512c 100644
--- a/ProcessList.c
+++ b/ProcessList.c
@@ -68,12 +68,6 @@ typedef enum TreeStr_ {
TREE_STR_COUNT
} TreeStr;
-typedef enum TreeType_ {
- TREE_TYPE_AUTO,
- TREE_TYPE_ASCII,
- TREE_TYPE_UTF8,
-} TreeType;
-
typedef struct CPUData_ {
unsigned long long int totalTime;
unsigned long long int userTime;
@@ -184,13 +178,13 @@ const char *ProcessList_treeStrUtf8[TREE_STR_COUNT] = {
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList) {
ProcessList* this;
this = calloc(sizeof(ProcessList), 1);
- this->processes = Vector_new(PROCESS_CLASS, true, DEFAULT_SIZE, Process_compare);
+ this->processes = Vector_new(Class(Process), true, DEFAULT_SIZE);
this->processTable = Hashtable_new(140, false);
this->usersTable = usersTable;
this->pidWhiteList = pidWhiteList;
/* tree-view auxiliary buffers */
- this->processes2 = Vector_new(PROCESS_CLASS, true, DEFAULT_SIZE, Process_compare);
+ this->processes2 = Vector_new(Class(Process), true, DEFAULT_SIZE);
FILE* file = fopen(PROCSTATFILE, "r");
if (file == NULL) {
@@ -243,6 +237,9 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidWhiteList) {
this->treeStr = NULL;
this->following = -1;
+ if (CRT_utf8)
+ this->treeStr = CRT_utf8 ? ProcessList_treeStrUtf8 : ProcessList_treeStrAscii;
+
return this;
}
@@ -312,7 +309,7 @@ int ProcessList_size(ProcessList* this) {
}
static void ProcessList_buildTree(ProcessList* this, pid_t pid, int level, int indent, int direction, bool show) {
- Vector* children = Vector_new(PROCESS_CLASS, false, DEFAULT_SIZE, Process_compare);
+ Vector* children = Vector_new(Class(Process), false, DEFAULT_SIZE);
for (int i = Vector_size(this->processes) - 1; i >= 0; i--) {
Process* process = (Process*) (Vector_get(this->processes, i));

© 2014-2024 Faster IT GmbH | imprint | privacy policy