Clean up existing whitespace

This commit is contained in:
Daniel Flanagan
2019-10-31 11:39:12 -05:00
parent 28840683cf
commit dd33444f7e
47 changed files with 155 additions and 155 deletions

View File

@ -78,7 +78,7 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short
const unsigned long int foundNum = atoi(foundNumStr);
free(foundNumStr);
free(line);
total += foundNum;
}
@ -175,7 +175,7 @@ static inline ssize_t xread(int fd, void *buf, size_t count) {
}
static void Battery_getSysData(double* level, ACPresence* isOnAC) {
*level = 0;
*isOnAC = AC_ERROR;
@ -194,7 +194,7 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
const char filePath[50];
if (entryName[0] == 'B' && entryName[1] == 'A' && entryName[2] == 'T') {
xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/uevent", entryName);
int fd = open(filePath, O_RDONLY);
if (fd == -1) {
@ -247,7 +247,7 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
if (*isOnAC != AC_ERROR) {
continue;
}
xSnprintf((char *) filePath, sizeof filePath, SYS_POWERSUPPLY_DIR "/%s/online", entryName);
int fd = open(filePath, O_RDONLY);
if (fd == -1) {

View File

@ -4,7 +4,7 @@ htop - IOPriority.c
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
Based on ionice,
Based on ionice,
Copyright (C) 2005 Jens Axboe <jens@axboe.dk>
Released under the terms of the GNU General Public License version 2
*/

View File

@ -8,7 +8,7 @@ htop - IOPriority.h
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
Based on ionice,
Based on ionice,
Copyright (C) 2005 Jens Axboe <jens@axboe.dk>
Released under the terms of the GNU General Public License version 2
*/

View File

@ -117,7 +117,7 @@ typedef struct LinuxProcess_ {
unsigned long long io_write_bytes;
unsigned long long io_cancelled_write_bytes;
unsigned long long io_rate_read_time;
unsigned long long io_rate_write_time;
unsigned long long io_rate_write_time;
double io_rate_read_bps;
double io_rate_write_bps;
#endif
@ -394,7 +394,7 @@ void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field)
attr = CRT_colors[PROCESS_HIGH_PRIORITY];
xSnprintf(buffer, n, "R%1d ", IOPriority_data(lp->ioPriority));
} else if (klass == IOPRIO_CLASS_IDLE) {
attr = CRT_colors[PROCESS_LOW_PRIORITY];
attr = CRT_colors[PROCESS_LOW_PRIORITY];
xSnprintf(buffer, n, "id ");
} else {
xSnprintf(buffer, n, "?? ");

View File

@ -108,7 +108,7 @@ typedef struct LinuxProcess_ {
unsigned long long io_write_bytes;
unsigned long long io_cancelled_write_bytes;
unsigned long long io_rate_read_time;
unsigned long long io_rate_write_time;
unsigned long long io_rate_write_time;
double io_rate_read_bps;
double io_rate_write_bps;
#endif

View File

@ -62,7 +62,7 @@ typedef struct CPUData_ {
unsigned long long int softIrqTime;
unsigned long long int stealTime;
unsigned long long int guestTime;
unsigned long long int totalPeriod;
unsigned long long int userPeriod;
unsigned long long int systemPeriod;
@ -86,10 +86,10 @@ typedef struct TtyDriver_ {
typedef struct LinuxProcessList_ {
ProcessList super;
CPUData* cpus;
TtyDriver* ttyDrivers;
#ifdef HAVE_DELAYACCT
struct nl_sock *netlink_socket;
int netlink_family;
@ -319,7 +319,7 @@ static bool LinuxProcessList_readStatFile(Process *process, const char* dirname,
location += 2;
char *end = strrchr(location, ')');
if (!end) return false;
int commsize = end - location;
memcpy(command, location, commsize);
command[commsize] = '\0';
@ -370,9 +370,9 @@ static bool LinuxProcessList_readStatFile(Process *process, const char* dirname,
location += 1;
assert(location != NULL);
process->processor = strtol(location, &location, 10);
process->time = lp->utime + lp->stime;
return true;
}
@ -412,7 +412,7 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
process->io_rate_write_time = -1LL;
return;
}
char buffer[1024];
ssize_t buflen = xread(fd, buffer, 1023);
close(fd);
@ -429,7 +429,7 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
process->io_rchar = strtoull(line+7, NULL, 10);
else if (strncmp(line+1, "ead_bytes: ", 11) == 0) {
process->io_read_bytes = strtoull(line+12, NULL, 10);
process->io_rate_read_bps =
process->io_rate_read_bps =
((double)(process->io_read_bytes - last_read))/(((double)(now - process->io_rate_read_time))/1000);
process->io_rate_read_time = now;
}
@ -439,7 +439,7 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
process->io_wchar = strtoull(line+7, NULL, 10);
else if (strncmp(line+1, "rite_bytes: ", 12) == 0) {
process->io_write_bytes = strtoull(line+13, NULL, 10);
process->io_rate_write_bps =
process->io_rate_write_bps =
((double)(process->io_write_bytes - last_write))/(((double)(now - process->io_rate_write_time))/1000);
process->io_rate_write_time = now;
}
@ -661,7 +661,7 @@ static void LinuxProcessList_readDelayAcctData(LinuxProcessList* this, LinuxProc
process->cpu_delay_percent = -1LL;
return;
}
if (nl_recvmsgs_default(this->netlink_socket) < 0) {
return;
}
@ -685,11 +685,11 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, const char* dirna
int fd = open(filename, O_RDONLY);
if (fd == -1)
return false;
char command[4096+1]; // max cmdline length on Linux
int amtRead = xread(fd, command, sizeof(command) - 1);
close(fd);
int tokenEnd = 0;
int tokenEnd = 0;
int lastChar = 0;
if (amtRead == 0) {
((LinuxProcess*)process)->isKernelThread = true;
@ -726,13 +726,13 @@ static char* LinuxProcessList_updateTtyDevice(TtyDriver* ttyDrivers, unsigned in
i++;
if ((!ttyDrivers[i].path) || maj < ttyDrivers[i].major) {
break;
}
}
if (maj > ttyDrivers[i].major) {
continue;
}
if (min < ttyDrivers[i].minorFrom) {
break;
}
}
if (min > ttyDrivers[i].minorTo) {
continue;
}
@ -790,17 +790,17 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
// filename is a number: process directory
int pid = atoi(name);
if (parent && pid == parent->pid)
continue;
if (pid <= 0)
if (pid <= 0)
continue;
bool preExisting = false;
Process* proc = ProcessList_getProcess(pl, pid, &preExisting, (Process_New) LinuxProcess_new);
proc->tgid = parent ? parent->pid : pid;
LinuxProcess* lp = (LinuxProcess*) proc;
char subdirname[MAX_NAME+1];
@ -846,7 +846,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
LinuxProcessList_readOpenVZData(lp, dirname, name);
}
#endif
#ifdef HAVE_VSERVER
if (settings->flags & PROCESS_FLAG_LINUX_VSERVER) {
LinuxProcessList_readVServerData(lp, dirname, name);
@ -874,7 +874,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
if (settings->flags & PROCESS_FLAG_LINUX_CGROUP)
LinuxProcessList_readCGroupFile(lp, dirname, name);
#endif
if (settings->flags & PROCESS_FLAG_LINUX_OOM)
LinuxProcessList_readOomData(lp, dirname, name);

View File

@ -35,7 +35,7 @@ typedef struct CPUData_ {
unsigned long long int softIrqTime;
unsigned long long int stealTime;
unsigned long long int guestTime;
unsigned long long int totalPeriod;
unsigned long long int userPeriod;
unsigned long long int systemPeriod;
@ -59,10 +59,10 @@ typedef struct TtyDriver_ {
typedef struct LinuxProcessList_ {
ProcessList super;
CPUData* cpus;
TtyDriver* ttyDrivers;
#ifdef HAVE_DELAYACCT
struct nl_sock *netlink_socket;
int netlink_family;