Skip to content

Commit 8d98786

Browse files
tanriolBenBE
authored andcommitted
ProcessList_buildTree: drop sort direction checking
This is only a partial check that does not take into account the sort field used and is overridden later anyway.
1 parent 58b42e4 commit 8d98786

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

ProcessList.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ static void ProcessList_updateTreeSet(ProcessList* this) {
332332
assert((int)Hashtable_count(this->displayTreeSet) == vsize);
333333
}
334334

335-
static void ProcessList_buildTreeBranch(ProcessList* this, pid_t pid, int level, int indent, int direction, bool show, int* node_counter, int* node_index) {
335+
static void ProcessList_buildTreeBranch(ProcessList* this, pid_t pid, int level, int indent, bool show, int* node_counter, int* node_index) {
336336
// On OpenBSD the kernel thread 'swapper' has pid 0.
337337
// Do not treat it as root of any tree.
338338
if (pid == 0)
@@ -362,16 +362,12 @@ static void ProcessList_buildTreeBranch(ProcessList* this, pid_t pid, int level,
362362
}
363363

364364
int s = Vector_size(this->displayList);
365-
if (direction == 1) {
366-
Vector_add(this->displayList, process);
367-
} else {
368-
Vector_insert(this->displayList, 0, process);
369-
}
365+
Vector_add(this->displayList, process);
370366

371367
assert(Vector_size(this->displayList) == s + 1); (void)s;
372368

373369
int nextIndent = indent | (1 << level);
374-
ProcessList_buildTreeBranch(this, process->pid, level + 1, (i < lastShown) ? nextIndent : indent, direction, process->show && process->showChildren, node_counter, node_index);
370+
ProcessList_buildTreeBranch(this, process->pid, level + 1, (i < lastShown) ? nextIndent : indent, process->show && process->showChildren, node_counter, node_index);
375371
if (i == lastShown) {
376372
process->indent = -nextIndent;
377373
} else {
@@ -409,7 +405,6 @@ static void ProcessList_buildTree(ProcessList* this) {
409405

410406
int node_counter = 1;
411407
int node_index = 0;
412-
int direction = ScreenSettings_getActiveDirection(this->settings->ss);
413408

414409
// Sort by PID
415410
Vector_quickSortCustomCompare(this->processes, ProcessList_treeProcessCompareByPID);
@@ -446,7 +441,7 @@ static void ProcessList_buildTree(ProcessList* this) {
446441
process->tree_index = node_index++;
447442
Vector_add(this->displayList, process);
448443
Hashtable_put(this->displayTreeSet, process->tree_index, process);
449-
ProcessList_buildTreeBranch(this, process->pid, 0, 0, direction, process->showChildren, &node_counter, &node_index);
444+
ProcessList_buildTreeBranch(this, process->pid, 0, 0, process->showChildren, &node_counter, &node_index);
450445
process->tree_right = node_counter++;
451446
continue;
452447
}

0 commit comments

Comments
 (0)