Skip to content

Commit

Permalink
Remove ProcessList_scanTs global
Browse files Browse the repository at this point in the history
  • Loading branch information
adsr committed Oct 18, 2020
1 parent 0413940 commit 7caabfc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Process.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@ void Process_toggleTag(Process* this) {
}

bool Process_isNew(const Process* this) {
if (ProcessList_scanTs >= this->seenTs)
return (ProcessList_scanTs - this->seenTs <= HIGHLIGHT_SECS);
if (this->processList && this->processList->scanTs >= this->seenTs)
return (this->processList->scanTs - this->seenTs <= HIGHLIGHT_SECS);
return false;
}

Expand Down
1 change: 1 addition & 0 deletions Process.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ typedef struct ProcessPidColumn_ {

typedef struct Process_ {
Object super;
struct ProcessList_* processList;

struct Settings_* settings;

Expand Down
4 changes: 1 addition & 3 deletions ProcessList.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ in the source distribution for its full text.
#include <string.h>
#include <time.h>

time_t ProcessList_scanTs = 0;

ProcessList* ProcessList_init(ProcessList* this, const ObjectClass* klass, UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) {
this->processes = Vector_new(klass, true, DEFAULT_SIZE);
this->processTable = Hashtable_new(140, false);
Expand Down Expand Up @@ -87,6 +85,7 @@ void ProcessList_printHeader(ProcessList* this, RichString* header) {
void ProcessList_add(ProcessList* this, Process* p) {
assert(Vector_indexOf(this->processes, p, Process_pidCompare) == -1);
assert(Hashtable_get(this->processTable, p->pid) == NULL);
p->processList = this;

if (this->scanTs == this->firstScanTs) {
// prevent highlighting processes found in first scan
Expand Down Expand Up @@ -315,7 +314,6 @@ void ProcessList_scan(ProcessList* this) {
this->firstScanTs = now.tv_sec;
}
this->scanTs = now.tv_sec;
ProcessList_scanTs = this->scanTs;
}

ProcessList_goThroughEntries(this);
Expand Down
2 changes: 0 additions & 2 deletions ProcessList.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,4 @@ Process* ProcessList_getProcess(ProcessList* this, pid_t pid, bool* preExisting,

void ProcessList_scan(ProcessList* this);

extern time_t ProcessList_scanTs;

#endif

0 comments on commit 7caabfc

Please sign in to comment.