summaryrefslogtreecommitdiffstats
path: root/linux
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-10-27 11:46:29 +0100
committercgzones <cgzones@googlemail.com>2020-10-27 18:00:43 +0100
commitac2b07eddd6f0b7c41b84b71653ca90fd301085f (patch)
tree0877120c0d42eed27a7f3d29a9fe79803cdd141f /linux
parent27870bd4deceff8396bbc569927716773b1aea29 (diff)
Avoid some unnecessary casts and mark some not changing variables const
Diffstat (limited to 'linux')
-rw-r--r--linux/LinuxProcess.c6
-rw-r--r--linux/LinuxProcess.h2
-rw-r--r--linux/LinuxProcessList.c5
-rw-r--r--linux/Platform.c2
4 files changed, 7 insertions, 8 deletions
diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c
index 23783ef0..fad80555 100644
--- a/linux/LinuxProcess.c
+++ b/linux/LinuxProcess.c
@@ -179,12 +179,12 @@ IOPriority LinuxProcess_updateIOPriority(LinuxProcess* this) {
return ioprio;
}
-bool LinuxProcess_setIOPriority(LinuxProcess* this, Arg ioprio) {
+bool LinuxProcess_setIOPriority(Process* this, Arg ioprio) {
// Other OSes masquerading as Linux (NetBSD?) don't have this syscall
#ifdef SYS_ioprio_set
- syscall(SYS_ioprio_set, IOPRIO_WHO_PROCESS, this->super.pid, ioprio.i);
+ syscall(SYS_ioprio_set, IOPRIO_WHO_PROCESS, this->pid, ioprio.i);
#endif
- return (LinuxProcess_updateIOPriority(this) == ioprio.i);
+ return (LinuxProcess_updateIOPriority((LinuxProcess*)this) == ioprio.i);
}
#ifdef HAVE_DELAYACCT
diff --git a/linux/LinuxProcess.h b/linux/LinuxProcess.h
index 45a3127f..80a4220b 100644
--- a/linux/LinuxProcess.h
+++ b/linux/LinuxProcess.h
@@ -183,7 +183,7 @@ extern io_priority;
IOPriority LinuxProcess_updateIOPriority(LinuxProcess* this);
-bool LinuxProcess_setIOPriority(LinuxProcess* this, Arg ioprio);
+bool LinuxProcess_setIOPriority(Process* this, Arg ioprio);
#ifdef HAVE_DELAYACCT
void LinuxProcess_printDelay(float delay_percent, char* buffer, int n);
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
index 5d9bc3c4..f7d01557 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -480,7 +480,6 @@ static bool LinuxProcessList_readSmapsFile(LinuxProcess* process, const char* di
//kernel will return data in chunks of size PAGE_SIZE or less.
char buffer[CRT_pageSize];// 4k
- char *start,*end;
ssize_t nread=0;
if(haveSmapsRollup) {// only available in Linux 4.14+
xSnprintf(buffer, sizeof(buffer), "%s/%s/smaps_rollup", dirname, name);
@@ -496,8 +495,8 @@ static bool LinuxProcessList_readSmapsFile(LinuxProcess* process, const char* di
process->m_psswp = 0;
while ( ( nread = read(fd,buffer, sizeof(buffer)) ) > 0 ){
- start = (char *)&buffer;
- end = start + nread;
+ char* start = buffer;
+ char* end = start + nread;
do{//parse 4k block
int tmp;
diff --git a/linux/Platform.c b/linux/Platform.c
index 43bf84b1..f6f7ba19 100644
--- a/linux/Platform.c
+++ b/linux/Platform.c
@@ -103,7 +103,7 @@ static Htop_Reaction Platform_actionSetIOPriority(State* st) {
void* set = Action_pickFromVector(st, ioprioPanel, 21, true);
if (set) {
IOPriority ioprio2 = IOPriorityPanel_getIOPriority(ioprioPanel);
- bool ok = MainPanel_foreachProcess((MainPanel*)panel, (MainPanel_ForeachProcessFn) LinuxProcess_setIOPriority, (Arg){ .i = ioprio2 }, NULL);
+ bool ok = MainPanel_foreachProcess((MainPanel*)panel, LinuxProcess_setIOPriority, (Arg){ .i = ioprio2 }, NULL);
if (!ok)
beep();
}

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