mirror of https://github.com/xzeldon/htop.git
Code indentation
This commit is contained in:
parent
e7f8d7bcc9
commit
458749df45
|
@ -31,9 +31,9 @@ static void ListItem_display(const Object* cast, RichString* out) {
|
|||
if (this->moving) {
|
||||
RichString_writeWide(out, CRT_colors[DEFAULT_COLOR],
|
||||
#ifdef HAVE_LIBNCURSESW
|
||||
CRT_utf8 ? "↕ " :
|
||||
CRT_utf8 ? "↕ " :
|
||||
#endif
|
||||
"+ ");
|
||||
"+ ");
|
||||
}
|
||||
RichString_appendWide(out, CRT_colors[DEFAULT_COLOR], this->value);
|
||||
}
|
||||
|
|
16
Process.c
16
Process.c
|
@ -405,13 +405,13 @@ void Process_makeCommandStr(Process *this) {
|
|||
/* this->mergedCommand.str needs updating only if its state or contents changed.
|
||||
* Its content is based on the fields cmdline, comm, and exe. */
|
||||
if (
|
||||
mc->prevMergeSet == showMergedCommand &&
|
||||
mc->prevPathSet == showProgramPath &&
|
||||
mc->prevCommSet == searchCommInCmdline &&
|
||||
mc->prevCmdlineSet == stripExeFromCmdline &&
|
||||
!mc->cmdlineChanged &&
|
||||
!mc->commChanged &&
|
||||
!mc->exeChanged
|
||||
mc->prevMergeSet == showMergedCommand &&
|
||||
mc->prevPathSet == showProgramPath &&
|
||||
mc->prevCommSet == searchCommInCmdline &&
|
||||
mc->prevCmdlineSet == stripExeFromCmdline &&
|
||||
!mc->cmdlineChanged &&
|
||||
!mc->commChanged &&
|
||||
!mc->exeChanged
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
@ -992,7 +992,7 @@ bool Process_isNew(const Process* this) {
|
|||
}
|
||||
|
||||
bool Process_isTomb(const Process* this) {
|
||||
return this->tombStampMs > 0;
|
||||
return this->tombStampMs > 0;
|
||||
}
|
||||
|
||||
bool Process_setPriority(Process* this, int priority) {
|
||||
|
|
2
Vector.h
2
Vector.h
|
@ -69,7 +69,7 @@ static inline int Vector_size(const Vector* this) {
|
|||
#endif /* NDEBUG */
|
||||
|
||||
static inline const ObjectClass* Vector_type(const Vector* this) {
|
||||
return this->type;
|
||||
return this->type;
|
||||
}
|
||||
|
||||
void Vector_add(Vector* this, void* data_);
|
||||
|
|
|
@ -324,14 +324,14 @@ char* Platform_getProcessEnv(pid_t pid) {
|
|||
}
|
||||
|
||||
char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
|
||||
(void)pid;
|
||||
(void)inode;
|
||||
return NULL;
|
||||
(void)pid;
|
||||
(void)inode;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
|
||||
(void)pid;
|
||||
return NULL;
|
||||
(void)pid;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool Platform_getDiskIO(DiskIOData* data) {
|
||||
|
|
|
@ -87,7 +87,7 @@ static inline bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int a
|
|||
}
|
||||
|
||||
static inline void Platform_gettime_realtime(struct timeval* tv, uint64_t* msec) {
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
}
|
||||
|
||||
void Platform_gettime_monotonic(uint64_t* msec);
|
||||
|
|
|
@ -219,14 +219,14 @@ char* Platform_getProcessEnv(pid_t pid) {
|
|||
}
|
||||
|
||||
char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
|
||||
(void)pid;
|
||||
(void)inode;
|
||||
return NULL;
|
||||
(void)pid;
|
||||
(void)inode;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
|
||||
(void)pid;
|
||||
return NULL;
|
||||
(void)pid;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool Platform_getDiskIO(DiskIOData* data) {
|
||||
|
|
|
@ -82,11 +82,11 @@ static inline bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int a
|
|||
}
|
||||
|
||||
static inline void Platform_gettime_realtime(struct timeval* tv, uint64_t* msec) {
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
}
|
||||
|
||||
static inline void Platform_gettime_monotonic(uint64_t* msec) {
|
||||
Generic_gettime_monotonic(msec);
|
||||
Generic_gettime_monotonic(msec);
|
||||
}
|
||||
|
||||
static inline Hashtable* Platform_dynamicMeters(void) {
|
||||
|
|
|
@ -558,9 +558,9 @@ void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate) {
|
|||
proc->percent_mem = 100.0 * proc->m_resident / (double)(super->totalMem);
|
||||
|
||||
if (kproc->ki_stat == SRUN && kproc->ki_oncpu != NOCPU) {
|
||||
proc->processor = kproc->ki_oncpu;
|
||||
proc->processor = kproc->ki_oncpu;
|
||||
} else {
|
||||
proc->processor = kproc->ki_lastcpu;
|
||||
proc->processor = kproc->ki_lastcpu;
|
||||
}
|
||||
|
||||
proc->majflt = kproc->ki_cow;
|
||||
|
|
|
@ -267,14 +267,14 @@ char* Platform_getProcessEnv(pid_t pid) {
|
|||
}
|
||||
|
||||
char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
|
||||
(void)pid;
|
||||
(void)inode;
|
||||
return NULL;
|
||||
(void)pid;
|
||||
(void)inode;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
|
||||
(void)pid;
|
||||
return NULL;
|
||||
(void)pid;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool Platform_getDiskIO(DiskIOData* data) {
|
||||
|
|
|
@ -82,11 +82,11 @@ static inline bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int a
|
|||
}
|
||||
|
||||
static inline void Platform_gettime_realtime(struct timeval* tv, uint64_t* msec) {
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
}
|
||||
|
||||
static inline void Platform_gettime_monotonic(uint64_t* msec) {
|
||||
Generic_gettime_monotonic(msec);
|
||||
Generic_gettime_monotonic(msec);
|
||||
}
|
||||
|
||||
static inline Hashtable* Platform_dynamicMeters(void) {
|
||||
|
|
|
@ -455,8 +455,8 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, openat_arg_t proc
|
|||
}
|
||||
|
||||
typedef struct LibraryData_ {
|
||||
uint64_t size;
|
||||
bool exec;
|
||||
uint64_t size;
|
||||
bool exec;
|
||||
} LibraryData;
|
||||
|
||||
static inline uint64_t fast_strtoull_dec(char **str, int maxlen) {
|
||||
|
@ -975,10 +975,10 @@ static void LinuxProcessList_readDelayAcctData(LinuxProcessList* this, LinuxProc
|
|||
struct nl_msg* msg;
|
||||
|
||||
if (!this->netlink_socket) {
|
||||
LinuxProcessList_initNetlinkSocket(this);
|
||||
if (!this->netlink_socket) {
|
||||
goto delayacct_failure;
|
||||
}
|
||||
LinuxProcessList_initNetlinkSocket(this);
|
||||
if (!this->netlink_socket) {
|
||||
goto delayacct_failure;
|
||||
}
|
||||
}
|
||||
|
||||
if (nl_socket_modify_cb(this->netlink_socket, NL_CB_VALID, NL_CB_CUSTOM, handleNetlinkMsg, process) < 0) {
|
||||
|
|
|
@ -98,11 +98,11 @@ void Platform_longOptionsUsage(const char* name);
|
|||
bool Platform_getLongOption(int opt, int argc, char** argv);
|
||||
|
||||
static inline void Platform_gettime_realtime(struct timeval* tv, uint64_t* msec) {
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
}
|
||||
|
||||
static inline void Platform_gettime_monotonic(uint64_t* msec) {
|
||||
Generic_gettime_monotonic(msec);
|
||||
Generic_gettime_monotonic(msec);
|
||||
}
|
||||
|
||||
static inline Hashtable* Platform_dynamicMeters(void) {
|
||||
|
|
|
@ -299,14 +299,14 @@ char* Platform_getProcessEnv(pid_t pid) {
|
|||
}
|
||||
|
||||
char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
|
||||
(void)pid;
|
||||
(void)inode;
|
||||
return NULL;
|
||||
(void)pid;
|
||||
(void)inode;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
|
||||
(void)pid;
|
||||
return NULL;
|
||||
(void)pid;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool Platform_getDiskIO(DiskIOData* data) {
|
||||
|
|
|
@ -87,11 +87,11 @@ static inline bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int a
|
|||
}
|
||||
|
||||
static inline void Platform_gettime_realtime(struct timeval* tv, uint64_t* msec) {
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
}
|
||||
|
||||
static inline void Platform_gettime_monotonic(uint64_t* msec) {
|
||||
Generic_gettime_monotonic(msec);
|
||||
Generic_gettime_monotonic(msec);
|
||||
}
|
||||
|
||||
static inline Hashtable* Platform_dynamicMeters(void) {
|
||||
|
|
|
@ -272,14 +272,14 @@ char* Platform_getProcessEnv(pid_t pid) {
|
|||
}
|
||||
|
||||
char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
|
||||
(void)pid;
|
||||
(void)inode;
|
||||
return NULL;
|
||||
(void)pid;
|
||||
(void)inode;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
|
||||
(void)pid;
|
||||
return NULL;
|
||||
(void)pid;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool Platform_getDiskIO(DiskIOData* data) {
|
||||
|
|
|
@ -80,11 +80,11 @@ static inline bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int a
|
|||
}
|
||||
|
||||
static inline void Platform_gettime_realtime(struct timeval* tv, uint64_t* msec) {
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
}
|
||||
|
||||
static inline void Platform_gettime_monotonic(uint64_t* msec) {
|
||||
Generic_gettime_monotonic(msec);
|
||||
Generic_gettime_monotonic(msec);
|
||||
}
|
||||
|
||||
static inline Hashtable* Platform_dynamicMeters(void) {
|
||||
|
|
|
@ -78,23 +78,23 @@ static void PCPDynamicMeter_parseMetric(PCPDynamicMeters* meters, PCPDynamicMete
|
|||
metric = PCPDynamicMeter_lookupMetric(meters, meter, key);
|
||||
if (String_eq(p, "color")) {
|
||||
if (String_eq(value, "gray"))
|
||||
metric->color = DYNAMIC_GRAY;
|
||||
metric->color = DYNAMIC_GRAY;
|
||||
else if (String_eq(value, "darkgray"))
|
||||
metric->color = DYNAMIC_DARKGRAY;
|
||||
metric->color = DYNAMIC_DARKGRAY;
|
||||
else if (String_eq(value, "red"))
|
||||
metric->color = DYNAMIC_RED;
|
||||
metric->color = DYNAMIC_RED;
|
||||
else if (String_eq(value, "green"))
|
||||
metric->color = DYNAMIC_GREEN;
|
||||
metric->color = DYNAMIC_GREEN;
|
||||
else if (String_eq(value, "blue"))
|
||||
metric->color = DYNAMIC_BLUE;
|
||||
metric->color = DYNAMIC_BLUE;
|
||||
else if (String_eq(value, "cyan"))
|
||||
metric->color = DYNAMIC_CYAN;
|
||||
metric->color = DYNAMIC_CYAN;
|
||||
else if (String_eq(value, "magenta"))
|
||||
metric->color = DYNAMIC_MAGENTA;
|
||||
metric->color = DYNAMIC_MAGENTA;
|
||||
else if (String_eq(value, "yellow"))
|
||||
metric->color = DYNAMIC_YELLOW;
|
||||
metric->color = DYNAMIC_YELLOW;
|
||||
else if (String_eq(value, "white"))
|
||||
metric->color = DYNAMIC_WHITE;
|
||||
metric->color = DYNAMIC_WHITE;
|
||||
} else if (String_eq(p, "label")) {
|
||||
char* label = String_cat(value, ": ");
|
||||
free_and_xStrdup(&metric->label, label);
|
||||
|
@ -204,13 +204,13 @@ static void PCPDynamicMeter_parseFile(PCPDynamicMeters* meters, const char* path
|
|||
free_and_xStrdup(&meter->super.description, value);
|
||||
} else if (value && meter && String_eq(key, "type")) {
|
||||
if (String_eq(config[1], "bar"))
|
||||
meter->super.type = BAR_METERMODE;
|
||||
meter->super.type = BAR_METERMODE;
|
||||
else if (String_eq(config[1], "text"))
|
||||
meter->super.type = TEXT_METERMODE;
|
||||
meter->super.type = TEXT_METERMODE;
|
||||
else if (String_eq(config[1], "graph"))
|
||||
meter->super.type = GRAPH_METERMODE;
|
||||
meter->super.type = GRAPH_METERMODE;
|
||||
else if (String_eq(config[1], "led"))
|
||||
meter->super.type = LED_METERMODE;
|
||||
meter->super.type = LED_METERMODE;
|
||||
} else if (value && meter && String_eq(key, "maximum")) {
|
||||
meter->super.maximum = strtod(value, NULL);
|
||||
} else if (value && meter) {
|
||||
|
|
|
@ -460,7 +460,7 @@ static void PCPProcessList_updateMemoryInfo(ProcessList* super) {
|
|||
super->totalSwap = value.ull;
|
||||
if (Metric_values(PCP_MEM_SWAPCACHED, &value, 1, PM_TYPE_U64) != NULL)
|
||||
super->cachedSwap = value.ull;
|
||||
super->usedSwap = super->totalSwap - swapFreeMem - super->cachedSwap;
|
||||
super->usedSwap = super->totalSwap - swapFreeMem - super->cachedSwap;
|
||||
}
|
||||
|
||||
/* make copies of previously sampled values to avoid overwrite */
|
||||
|
|
|
@ -670,15 +670,15 @@ void Platform_setZramValues(Meter* this) {
|
|||
|
||||
if (Metric_values(PCP_ZRAM_CAPACITY, values, count, PM_TYPE_U64)) {
|
||||
for (i = 0; i < count; i++)
|
||||
stats.totalZram += values[i].ull;
|
||||
stats.totalZram += values[i].ull;
|
||||
}
|
||||
if (Metric_values(PCP_ZRAM_ORIGINAL, values, count, PM_TYPE_U64)) {
|
||||
for (i = 0; i < count; i++)
|
||||
stats.usedZramOrig += values[i].ull;
|
||||
stats.usedZramOrig += values[i].ull;
|
||||
}
|
||||
if (Metric_values(PCP_ZRAM_COMPRESSED, values, count, PM_TYPE_U64)) {
|
||||
for (i = 0; i < count; i++)
|
||||
stats.usedZramComp += values[i].ull;
|
||||
stats.usedZramComp += values[i].ull;
|
||||
}
|
||||
|
||||
free(values);
|
||||
|
@ -701,8 +701,8 @@ void Platform_setZfsCompressedArcValues(Meter* this) {
|
|||
}
|
||||
|
||||
void Platform_getHostname(char* buffer, size_t size) {
|
||||
const char* hostname = pmGetContextHostName(pcp->context);
|
||||
String_safeStrncpy(buffer, hostname, size);
|
||||
const char* hostname = pmGetContextHostName(pcp->context);
|
||||
String_safeStrncpy(buffer, hostname, size);
|
||||
}
|
||||
|
||||
void Platform_getRelease(char** string) {
|
||||
|
|
|
@ -287,14 +287,14 @@ char* Platform_getProcessEnv(pid_t pid) {
|
|||
}
|
||||
|
||||
char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
|
||||
(void)pid;
|
||||
(void)inode;
|
||||
return NULL;
|
||||
(void)pid;
|
||||
(void)inode;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
|
||||
(void)pid;
|
||||
return NULL;
|
||||
(void)pid;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool Platform_getDiskIO(DiskIOData* data) {
|
||||
|
|
|
@ -109,11 +109,11 @@ static inline bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int a
|
|||
}
|
||||
|
||||
static inline void Platform_gettime_realtime(struct timeval* tv, uint64_t* msec) {
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
}
|
||||
|
||||
static inline void Platform_gettime_monotonic(uint64_t* msec) {
|
||||
Generic_gettime_monotonic(msec);
|
||||
Generic_gettime_monotonic(msec);
|
||||
}
|
||||
|
||||
static inline void* kstat_data_lookup_wrapper(kstat_t* ksp, const char* name) {
|
||||
|
|
|
@ -124,14 +124,14 @@ char* Platform_getProcessEnv(pid_t pid) {
|
|||
}
|
||||
|
||||
char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
|
||||
(void)pid;
|
||||
(void)inode;
|
||||
return NULL;
|
||||
(void)pid;
|
||||
(void)inode;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid) {
|
||||
(void)pid;
|
||||
return NULL;
|
||||
(void)pid;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool Platform_getDiskIO(DiskIOData* data) {
|
||||
|
@ -154,5 +154,5 @@ void Platform_getHostname(char* buffer, size_t size) {
|
|||
}
|
||||
|
||||
void Platform_getRelease(char** string) {
|
||||
*string = xStrdup(Platform_unsupported);
|
||||
*string = xStrdup(Platform_unsupported);
|
||||
}
|
||||
|
|
|
@ -71,11 +71,11 @@ static inline bool Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int a
|
|||
}
|
||||
|
||||
static inline void Platform_gettime_realtime(struct timeval* tv, uint64_t* msec) {
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
Generic_gettime_realtime(tv, msec);
|
||||
}
|
||||
|
||||
static inline void Platform_gettime_monotonic(uint64_t* msec) {
|
||||
Generic_gettime_monotonic(msec);
|
||||
Generic_gettime_monotonic(msec);
|
||||
}
|
||||
|
||||
static inline Hashtable* Platform_dynamicMeters(void) {
|
||||
|
|
Loading…
Reference in New Issue