mirror of https://github.com/xzeldon/htop.git
Spacing around operators
This commit is contained in:
parent
b23f8235e2
commit
61e14d4bb2
|
@ -79,7 +79,9 @@ void InfoScreen_appendLine(InfoScreen* this, const char* line) {
|
|||
void InfoScreen_run(InfoScreen* this) {
|
||||
Panel* panel = this->display;
|
||||
|
||||
if (As_InfoScreen(this)->scan) InfoScreen_scan(this);
|
||||
if (As_InfoScreen(this)->scan)
|
||||
InfoScreen_scan(this);
|
||||
|
||||
InfoScreen_draw(this);
|
||||
|
||||
bool looping = true;
|
||||
|
@ -145,7 +147,8 @@ void InfoScreen_run(InfoScreen* this) {
|
|||
break;
|
||||
case KEY_RESIZE:
|
||||
Panel_resize(panel, COLS, LINES - 2);
|
||||
if (As_InfoScreen(this)->scan) InfoScreen_scan(this);
|
||||
if (As_InfoScreen(this)->scan)
|
||||
InfoScreen_scan(this);
|
||||
InfoScreen_draw(this);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -153,7 +153,9 @@ bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Ar
|
|||
}
|
||||
if (!anyTagged) {
|
||||
Process* p = (Process*) Panel_getSelected(super);
|
||||
if (p) ok = fn(p, arg) && ok;
|
||||
if (p) {
|
||||
ok &= fn(p, arg);
|
||||
}
|
||||
}
|
||||
if (wasAnyTagged)
|
||||
*wasAnyTagged = anyTagged;
|
||||
|
|
|
@ -141,7 +141,8 @@ void TraceScreen_updateTrace(InfoScreen* super) {
|
|||
FD_SET(fd_strace, &fds);
|
||||
|
||||
struct timeval tv;
|
||||
tv.tv_sec = 0; tv.tv_usec = 500;
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 500;
|
||||
int ready = select(fd_strace + 1, &fds, NULL, NULL, &tv);
|
||||
size_t nread = 0;
|
||||
if (ready > 0 && FD_ISSET(fd_strace, &fds))
|
||||
|
|
2
Vector.c
2
Vector.c
|
@ -118,6 +118,7 @@ static int partition(Object** array, int left, int right, int pivotIndex, Object
|
|||
static void quickSort(Object** array, int left, int right, Object_Compare compare) {
|
||||
if (left >= right)
|
||||
return;
|
||||
|
||||
int pivotIndex = (left + right) / 2;
|
||||
int pivotNewIndex = partition(array, left, right, pivotIndex, compare);
|
||||
quickSort(array, left, pivotNewIndex - 1, compare);
|
||||
|
@ -155,6 +156,7 @@ static void insertionSort(Object** array, int left, int right, Object_Compare co
|
|||
//comparisons++;
|
||||
if (compare(array[j], t) <= 0)
|
||||
break;
|
||||
|
||||
array[j + 1] = array[j];
|
||||
j--;
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ static ACPresence procAcpiCheck(void) {
|
|||
continue;
|
||||
|
||||
char statePath[256];
|
||||
xSnprintf((char *) statePath, sizeof statePath, "%s/%s/state", power_supplyPath, entryName);
|
||||
xSnprintf(statePath, sizeof(statePath), "%s/%s/state", power_supplyPath, entryName);
|
||||
FILE* file = fopen(statePath, "r");
|
||||
if (!file) {
|
||||
isOn = AC_ERROR;
|
||||
|
|
|
@ -359,7 +359,8 @@ static bool LinuxProcessList_readStatFile(Process *process, const char* dirname,
|
|||
location = strchr(location, ' ') + 1;
|
||||
}
|
||||
location += 1;
|
||||
for (int i=0; i<15; i++) location = strchr(location, ' ')+1;
|
||||
for (int i = 0; i < 15; i++)
|
||||
location = strchr(location, ' ') + 1;
|
||||
process->exit_signal = strtol(location, &location, 10);
|
||||
location += 1;
|
||||
assert(location != NULL);
|
||||
|
@ -778,13 +779,14 @@ static int handleNetlinkMsg(struct nl_msg *nlmsg, void *linuxProcess) {
|
|||
assert(lp->super.pid == (pid_t)stats.ac_pid);
|
||||
|
||||
timeDelta = (stats.ac_etime * 1000 - lp->delay_read_time);
|
||||
#define BOUNDS(x) isnan(x) ? 0.0 : ((x) > 100) ? 100.0 : (x)
|
||||
#define BOUNDS(x) (isnan(x) ? 0.0 : ((x) > 100) ? 100.0 : (x))
|
||||
#define DELTAPERC(x,y) BOUNDS((float) ((x) - (y)) / timeDelta * 100)
|
||||
lp->cpu_delay_percent = DELTAPERC(stats.cpu_delay_total, lp->cpu_delay_total);
|
||||
lp->blkio_delay_percent = DELTAPERC(stats.blkio_delay_total, lp->blkio_delay_total);
|
||||
lp->swapin_delay_percent = DELTAPERC(stats.swapin_delay_total, lp->swapin_delay_total);
|
||||
#undef DELTAPERC
|
||||
#undef BOUNDS
|
||||
|
||||
lp->swapin_delay_total = stats.swapin_delay_total;
|
||||
lp->blkio_delay_total = stats.blkio_delay_total;
|
||||
lp->cpu_delay_total = stats.cpu_delay_total;
|
||||
|
|
|
@ -169,7 +169,10 @@ int Platform_getUptime() {
|
|||
|
||||
void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
|
||||
int activeProcs, totalProcs, lastProc;
|
||||
*one = 0; *five = 0; *fifteen = 0;
|
||||
*one = 0;
|
||||
*five = 0;
|
||||
*fifteen = 0;
|
||||
|
||||
FILE* fd = fopen(PROCDIR "/loadavg", "r");
|
||||
if (fd) {
|
||||
int total = fscanf(fd, "%32lf %32lf %32lf %32d/%32d %32d", one, five, fifteen,
|
||||
|
|
|
@ -177,7 +177,7 @@ char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, in
|
|||
*/
|
||||
static double getpcpu(const struct kinfo_proc* kp) {
|
||||
if (fscale == 0)
|
||||
return (0.0);
|
||||
return 0.0;
|
||||
|
||||
#define fxtofl(fixpt) ((double)(fixpt) / fscale)
|
||||
|
||||
|
|
|
@ -160,7 +160,9 @@ static inline void SolarisProcessList_scanMemoryInfo(ProcessList* pl) {
|
|||
// Look up the kstat chain just one, it never changes
|
||||
meminfo = kstat_lookup(spl->kd, "unix", 0, "system_pages");
|
||||
}
|
||||
if (meminfo != NULL) { ksrphyserr = kstat_read(spl->kd,meminfo,NULL); }
|
||||
if (meminfo != NULL) {
|
||||
ksrphyserr = kstat_read(spl->kd, meminfo, NULL);
|
||||
}
|
||||
if (ksrphyserr != -1) {
|
||||
totalmem_pgs = kstat_data_lookup(meminfo, "physmem");
|
||||
freemem_pgs = kstat_data_lookup(meminfo, "freemem");
|
||||
|
@ -369,8 +371,12 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
|
|||
}
|
||||
|
||||
// Top-level process only gets this for the representative LWP
|
||||
if (sproc->kernel && !pl->settings->hideKernelThreads) proc->show = true;
|
||||
if (!sproc->kernel && !pl->settings->hideUserlandThreads) proc->show = true;
|
||||
if (sproc->kernel && !pl->settings->hideKernelThreads) {
|
||||
proc->show = true;
|
||||
}
|
||||
if (!sproc->kernel && !pl->settings->hideUserlandThreads) {
|
||||
proc->show = true;
|
||||
}
|
||||
} // Top-level LWP or subordinate LWP
|
||||
|
||||
// Common code pass 2
|
||||
|
|
Loading…
Reference in New Issue