Skip to content

Commit

Permalink
Use spaceship comparison for TTYs
Browse files Browse the repository at this point in the history
  • Loading branch information
cgzones authored and BenBE committed Nov 15, 2020
1 parent f856fe6 commit 0411fdb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion linux/LinuxProcessList.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ static ssize_t xread(int fd, void* buf, size_t count) {
static int sortTtyDrivers(const void* va, const void* vb) {
const TtyDriver* a = (const TtyDriver*) va;
const TtyDriver* b = (const TtyDriver*) vb;
return (a->major == b->major) ? ((int)a->minorFrom - (int)b->minorFrom) : ((int)a->major - (int)b->major);

int r = SPACESHIP_NUMBER(a->major, b->major);
if (r)
return r;

return SPACESHIP_NUMBER(a->minorFrom, b->minorFrom);
}

static void LinuxProcessList_initTtyDrivers(LinuxProcessList* this) {
Expand Down

0 comments on commit 0411fdb

Please sign in to comment.