mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-12 12:14:36 +03:00
Avoid some unnecessary casts and mark some not changing variables const
This commit is contained in:

committed by
cgzones

parent
27870bd4de
commit
ac2b07eddd
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user