diff options
Diffstat (limited to 'Process.c')
-rw-r--r-- | Process.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -416,6 +416,10 @@ void Process_done(Process* this) { free(this->comm); } +static const char* Process_getCommandStr(const Process* p) { + return p->comm ? p->comm : ""; +} + const ProcessClass Process_class = { .super = { .extends = Class(Object), @@ -424,6 +428,7 @@ const ProcessClass Process_class = { .compare = Process_compare }, .writeField = Process_writeField, + .getCommandStr = Process_getCommandStr, }; void Process_init(Process* this, const struct Settings_* settings) { @@ -503,7 +508,7 @@ long Process_compare(const void* v1, const void* v2) { case PERCENT_MEM: return SPACESHIP_NUMBER(p2->m_resident, p1->m_resident); case COMM: - return SPACESHIP_NULLSTR(p1->comm, p2->comm); + return SPACESHIP_NULLSTR(Process_getCommand(p1), Process_getCommand(p2)); case MAJFLT: return SPACESHIP_NUMBER(p2->majflt, p1->majflt); case MINFLT: |