mirror of https://github.com/xzeldon/htop.git
Pointer indication aligned to typename
This commit is contained in:
parent
68edf92434
commit
976c6123f4
|
@ -124,7 +124,7 @@ static void AvailableMetersPanel_addDynamicMeter(ATTR_UNUSED ht_key_t key, void*
|
|||
}
|
||||
|
||||
// Handle (&DynamicMeter_class) entries in the AvailableMetersPanel
|
||||
static void AvailableMetersPanel_addDynamicMeters(Panel* super, const ProcessList *pl, unsigned int offset) {
|
||||
static void AvailableMetersPanel_addDynamicMeters(Panel* super, const ProcessList* pl, unsigned int offset) {
|
||||
DynamicIterator iter = { .super = super, .id = 1, .offset = offset };
|
||||
assert(pl->dynamicMeters != NULL);
|
||||
Hashtable_foreach(pl->dynamicMeters, AvailableMetersPanel_addDynamicMeter, &iter);
|
||||
|
|
2
CRT.c
2
CRT.c
|
@ -1024,7 +1024,7 @@ void CRT_handleSIGSEGV(int signal) {
|
|||
"---\n"
|
||||
);
|
||||
|
||||
void *backtraceArray[256];
|
||||
void* backtraceArray[256];
|
||||
|
||||
size_t size = backtrace(backtraceArray, ARRAYSIZE(backtraceArray));
|
||||
backtrace_symbols_fd(backtraceArray, size, STDERR_FILENO);
|
||||
|
|
2
Meter.h
2
Meter.h
|
@ -53,7 +53,7 @@ typedef void(*Meter_Done)(Meter*);
|
|||
typedef void(*Meter_UpdateMode)(Meter*, int);
|
||||
typedef void(*Meter_UpdateValues)(Meter*);
|
||||
typedef void(*Meter_Draw)(Meter*, int, int, int);
|
||||
typedef const char*(*Meter_GetCaption)(const Meter*);
|
||||
typedef const char* (*Meter_GetCaption)(const Meter*);
|
||||
typedef void(*Meter_GetUiName)(const Meter*, char*, size_t);
|
||||
|
||||
typedef struct MeterClass_ {
|
||||
|
|
50
Process.c
50
Process.c
|
@ -36,7 +36,7 @@ in the source distribution for its full text.
|
|||
|
||||
|
||||
/* Used to identify kernel threads in Comm and Exe columns */
|
||||
static const char *const kthreadID = "KTHREAD";
|
||||
static const char* const kthreadID = "KTHREAD";
|
||||
|
||||
static uid_t Process_getuid = (uid_t)-1;
|
||||
|
||||
|
@ -268,18 +268,18 @@ void Process_fillStarttimeBuffer(Process* this) {
|
|||
*/
|
||||
#define TASK_COMM_LEN 16
|
||||
|
||||
static bool findCommInCmdline(const char *comm, const char *cmdline, int cmdlineBasenameStart, int *pCommStart, int *pCommEnd) {
|
||||
static bool findCommInCmdline(const char* comm, const char* cmdline, int cmdlineBasenameStart, int* pCommStart, int* pCommEnd) {
|
||||
/* Try to find procComm in tokenized cmdline - this might in rare cases
|
||||
* mis-identify a string or fail, if comm or cmdline had been unsuitably
|
||||
* modified by the process */
|
||||
const char *tokenBase;
|
||||
const char* tokenBase;
|
||||
size_t tokenLen;
|
||||
const size_t commLen = strlen(comm);
|
||||
|
||||
if (cmdlineBasenameStart < 0)
|
||||
return false;
|
||||
|
||||
for (const char *token = cmdline + cmdlineBasenameStart; *token;) {
|
||||
for (const char* token = cmdline + cmdlineBasenameStart; *token;) {
|
||||
for (tokenBase = token; *token && *token != '\n'; ++token) {
|
||||
if (*token == '/') {
|
||||
tokenBase = token + 1;
|
||||
|
@ -303,7 +303,7 @@ static bool findCommInCmdline(const char *comm, const char *cmdline, int cmdline
|
|||
return false;
|
||||
}
|
||||
|
||||
static int matchCmdlinePrefixWithExeSuffix(const char *cmdline, int cmdlineBaseOffset, const char *exe, int exeBaseOffset, int exeBaseLen) {
|
||||
static int matchCmdlinePrefixWithExeSuffix(const char* cmdline, int cmdlineBaseOffset, const char* exe, int exeBaseOffset, int exeBaseLen) {
|
||||
int matchLen; /* matching length to be returned */
|
||||
char delim; /* delimiter following basename */
|
||||
|
||||
|
@ -368,7 +368,7 @@ static int matchCmdlinePrefixWithExeSuffix(const char *cmdline, int cmdlineBaseO
|
|||
}
|
||||
|
||||
/* stpcpy, but also converts newlines to spaces */
|
||||
static inline char *stpcpyWithNewlineConversion(char *dstStr, const char *srcStr) {
|
||||
static inline char* stpcpyWithNewlineConversion(char* dstStr, const char* srcStr) {
|
||||
for (; *srcStr; ++srcStr) {
|
||||
*dstStr++ = (*srcStr == '\n') ? ' ' : *srcStr;
|
||||
}
|
||||
|
@ -382,9 +382,9 @@ static inline char *stpcpyWithNewlineConversion(char *dstStr, const char *srcStr
|
|||
* Process_writeCommand() for coloring. The merged Command string is also
|
||||
* returned by Process_getCommandStr() for searching, sorting and filtering.
|
||||
*/
|
||||
void Process_makeCommandStr(Process *this) {
|
||||
ProcessMergedCommand *mc = &this->mergedCommand;
|
||||
const Settings *settings = this->settings;
|
||||
void Process_makeCommandStr(Process* this) {
|
||||
ProcessMergedCommand* mc = &this->mergedCommand;
|
||||
const Settings* settings = this->settings;
|
||||
|
||||
bool showMergedCommand = settings->showMergedCommand;
|
||||
bool showProgramPath = settings->showProgramPath;
|
||||
|
@ -418,7 +418,7 @@ void Process_makeCommandStr(Process *this) {
|
|||
|
||||
/* The field separtor "│" has been chosen such that it will not match any
|
||||
* valid string used for searching or filtering */
|
||||
const char *SEPARATOR = CRT_treeStr[TREE_STR_VERT];
|
||||
const char* SEPARATOR = CRT_treeStr[TREE_STR_VERT];
|
||||
const int SEPARATOR_LEN = strlen(SEPARATOR);
|
||||
|
||||
/* Check for any changed fields since we last built this string */
|
||||
|
@ -476,12 +476,12 @@ void Process_makeCommandStr(Process *this) {
|
|||
const int delLibAttr = CRT_colors[PROCESS_TAG];
|
||||
|
||||
/* Establish some shortcuts to data we need */
|
||||
const char *cmdline = this->cmdline;
|
||||
const char *procComm = this->procComm;
|
||||
const char *procExe = this->procExe;
|
||||
const char* cmdline = this->cmdline;
|
||||
const char* procComm = this->procComm;
|
||||
const char* procExe = this->procExe;
|
||||
|
||||
char *strStart = mc->str;
|
||||
char *str = strStart;
|
||||
char* strStart = mc->str;
|
||||
char* str = strStart;
|
||||
|
||||
int cmdlineBasenameStart = this->cmdlineBasenameStart;
|
||||
int cmdlineBasenameEnd = this->cmdlineBasenameEnd;
|
||||
|
@ -593,7 +593,7 @@ void Process_makeCommandStr(Process *this) {
|
|||
void Process_writeCommand(const Process* this, int attr, int baseAttr, RichString* str) {
|
||||
(void)baseAttr;
|
||||
|
||||
const ProcessMergedCommand *mc = &this->mergedCommand;
|
||||
const ProcessMergedCommand* mc = &this->mergedCommand;
|
||||
|
||||
int strStart = RichString_size(str);
|
||||
|
||||
|
@ -637,7 +637,7 @@ void Process_writeCommand(const Process* this, int attr, int baseAttr, RichStrin
|
|||
RichString_appendWide(str, attr, this->mergedCommand.str);
|
||||
|
||||
for (size_t i = 0, hlCount = CLAMP(mc->highlightCount, 0, ARRAYSIZE(mc->highlights)); i < hlCount; i++) {
|
||||
const ProcessCmdlineHighlight *hl = &mc->highlights[i];
|
||||
const ProcessCmdlineHighlight* hl = &mc->highlights[i];
|
||||
|
||||
if (!hl->length)
|
||||
continue;
|
||||
|
@ -946,7 +946,7 @@ void Process_done(Process* this) {
|
|||
/* This function returns the string displayed in Command column, so that sorting
|
||||
* happens on what is displayed - whether comm, full path, basename, etc.. So
|
||||
* this follows Process_writeField(COMM) and Process_writeCommand */
|
||||
const char *Process_getCommandStr(const Process *this) {
|
||||
const char* Process_getCommandStr(const Process* this) {
|
||||
if ((Process_isUserlandThread(this) && this->settings->showThreadNames) || !this->mergedCommand.str) {
|
||||
return this->cmdline;
|
||||
}
|
||||
|
@ -1024,10 +1024,10 @@ int Process_pidCompare(const void* v1, const void* v2) {
|
|||
}
|
||||
|
||||
int Process_compare(const void* v1, const void* v2) {
|
||||
const Process *p1 = (const Process*)v1;
|
||||
const Process *p2 = (const Process*)v2;
|
||||
const Process* p1 = (const Process*)v1;
|
||||
const Process* p2 = (const Process*)v2;
|
||||
|
||||
const Settings *settings = p1->settings;
|
||||
const Settings* settings = p1->settings;
|
||||
|
||||
ProcessField key = Settings_getActiveSortKey(settings);
|
||||
|
||||
|
@ -1090,13 +1090,13 @@ int Process_compareByKey_Base(const Process* p1, const Process* p2, ProcessField
|
|||
case COMM:
|
||||
return SPACESHIP_NULLSTR(Process_getCommand(p1), Process_getCommand(p2));
|
||||
case PROC_COMM: {
|
||||
const char *comm1 = p1->procComm ? p1->procComm : (Process_isKernelThread(p1) ? kthreadID : "");
|
||||
const char *comm2 = p2->procComm ? p2->procComm : (Process_isKernelThread(p2) ? kthreadID : "");
|
||||
const char* comm1 = p1->procComm ? p1->procComm : (Process_isKernelThread(p1) ? kthreadID : "");
|
||||
const char* comm2 = p2->procComm ? p2->procComm : (Process_isKernelThread(p2) ? kthreadID : "");
|
||||
return SPACESHIP_NULLSTR(comm1, comm2);
|
||||
}
|
||||
case PROC_EXE: {
|
||||
const char *exe1 = p1->procExe ? (p1->procExe + p1->procExeBasenameOffset) : (Process_isKernelThread(p1) ? kthreadID : "");
|
||||
const char *exe2 = p2->procExe ? (p2->procExe + p2->procExeBasenameOffset) : (Process_isKernelThread(p2) ? kthreadID : "");
|
||||
const char* exe1 = p1->procExe ? (p1->procExe + p1->procExeBasenameOffset) : (Process_isKernelThread(p1) ? kthreadID : "");
|
||||
const char* exe2 = p2->procExe ? (p2->procExe + p2->procExeBasenameOffset) : (Process_isKernelThread(p2) ? kthreadID : "");
|
||||
return SPACESHIP_NULLSTR(exe1, exe2);
|
||||
}
|
||||
case CWD:
|
||||
|
|
22
Process.h
22
Process.h
|
@ -75,7 +75,7 @@ typedef struct ProcessCmdlineHighlight_ {
|
|||
* Process_writeCommand to color the string. str will be NULL for kernel
|
||||
* threads and zombies */
|
||||
typedef struct ProcessMergedCommand_ {
|
||||
char *str; /* merged Command string */
|
||||
char* str; /* merged Command string */
|
||||
size_t highlightCount; /* how many portions of cmdline to highlight */
|
||||
ProcessCmdlineHighlight highlights[8]; /* which portions of cmdline to highlight */
|
||||
bool separateComm : 1; /* whether comm is a separate field */
|
||||
|
@ -149,13 +149,13 @@ typedef struct Process_ {
|
|||
int cmdlineBasenameStart;
|
||||
|
||||
/* The process' "command" name */
|
||||
char *procComm;
|
||||
char* procComm;
|
||||
|
||||
/* The main process executable */
|
||||
char *procExe;
|
||||
char* procExe;
|
||||
|
||||
/* The process/thread working directory */
|
||||
char *procCwd;
|
||||
char* procCwd;
|
||||
|
||||
/* Offset in procExe of the process basename */
|
||||
int procExeBasenameOffset;
|
||||
|
@ -281,7 +281,7 @@ extern const ProcessFieldData Process_fields[LAST_PROCESSFIELD];
|
|||
#define PROCESS_MAX_PID_DIGITS 19
|
||||
extern int Process_pidDigits;
|
||||
|
||||
typedef Process*(*Process_New)(const struct Settings_*);
|
||||
typedef Process* (*Process_New)(const struct Settings_*);
|
||||
typedef void (*Process_WriteField)(const Process*, RichString*, ProcessField);
|
||||
typedef int (*Process_CompareByKey)(const Process*, const Process*, ProcessField);
|
||||
typedef const char* (*Process_GetCommandStr)(const Process*);
|
||||
|
@ -306,15 +306,15 @@ static inline bool Process_isChildOf(const Process* this, pid_t pid) {
|
|||
return pid == Process_getParentPid(this);
|
||||
}
|
||||
|
||||
static inline bool Process_isKernelThread(const Process *this) {
|
||||
static inline bool Process_isKernelThread(const Process* this) {
|
||||
return this->isKernelThread;
|
||||
}
|
||||
|
||||
static inline bool Process_isUserlandThread(const Process *this) {
|
||||
static inline bool Process_isUserlandThread(const Process* this) {
|
||||
return this->isUserlandThread;
|
||||
}
|
||||
|
||||
static inline bool Process_isThread(const Process *this) {
|
||||
static inline bool Process_isThread(const Process* this) {
|
||||
return Process_isUserlandThread(this) || Process_isKernelThread(this);
|
||||
}
|
||||
|
||||
|
@ -381,7 +381,7 @@ int Process_pidCompare(const void* v1, const void* v2);
|
|||
int Process_compareByKey_Base(const Process* p1, const Process* p2, ProcessField key);
|
||||
|
||||
// Avoid direct calls, use Process_getCommand instead
|
||||
const char *Process_getCommandStr(const Process *this);
|
||||
const char* Process_getCommandStr(const Process* this);
|
||||
|
||||
void Process_updateComm(Process* this, const char* comm);
|
||||
void Process_updateCmdline(Process* this, const char* cmdline, int basenameStart, int basenameEnd);
|
||||
|
@ -389,8 +389,8 @@ void Process_updateExe(Process* this, const char* exe);
|
|||
|
||||
/* This function constructs the string that is displayed by
|
||||
* Process_writeCommand and also returned by Process_getCommandStr */
|
||||
void Process_makeCommandStr(Process *this);
|
||||
void Process_makeCommandStr(Process* this);
|
||||
|
||||
void Process_writeCommand(const Process *this, int attr, int baseAttr, RichString *str);
|
||||
void Process_writeCommand(const Process* this, int attr, int baseAttr, RichString* str);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -361,15 +361,15 @@ static void ProcessList_buildTreeBranch(ProcessList* this, pid_t pid, int level,
|
|||
}
|
||||
|
||||
static int ProcessList_treeProcessCompare(const void* v1, const void* v2) {
|
||||
const Process *p1 = (const Process*)v1;
|
||||
const Process *p2 = (const Process*)v2;
|
||||
const Process* p1 = (const Process*)v1;
|
||||
const Process* p2 = (const Process*)v2;
|
||||
|
||||
return SPACESHIP_NUMBER(p1->tree_left, p2->tree_left);
|
||||
}
|
||||
|
||||
static int ProcessList_treeProcessCompareByPID(const void* v1, const void* v2) {
|
||||
const Process *p1 = (const Process*)v1;
|
||||
const Process *p2 = (const Process*)v2;
|
||||
const Process* p1 = (const Process*)v1;
|
||||
const Process* p2 = (const Process*)v2;
|
||||
|
||||
return SPACESHIP_NUMBER(p1->pid, p2->pid);
|
||||
}
|
||||
|
|
2
XUtils.c
2
XUtils.c
|
@ -193,7 +193,7 @@ char* String_readLine(FILE* fd) {
|
|||
}
|
||||
}
|
||||
|
||||
size_t String_safeStrncpy(char *restrict dest, const char *restrict src, size_t size) {
|
||||
size_t String_safeStrncpy(char* restrict dest, const char* restrict src, size_t size) {
|
||||
assert(size > 0);
|
||||
|
||||
size_t i = 0;
|
||||
|
|
2
XUtils.h
2
XUtils.h
|
@ -60,7 +60,7 @@ char* String_getToken(const char* line, unsigned short int numMatch) ATTR_MALLOC
|
|||
char* String_readLine(FILE* fd) ATTR_MALLOC;
|
||||
|
||||
/* Always null-terminates dest. Caller must pass a strictly positive size. */
|
||||
size_t String_safeStrncpy(char *restrict dest, const char *restrict src, size_t size);
|
||||
size_t String_safeStrncpy(char* restrict dest, const char* restrict src, size_t size);
|
||||
|
||||
ATTR_FORMAT(printf, 2, 3)
|
||||
int xAsprintf(char** strp, const char* fmt, ...);
|
||||
|
|
|
@ -68,7 +68,7 @@ bool Platform_getDiskIO(DiskIOData* data);
|
|||
|
||||
bool Platform_getNetworkIO(NetworkIOData* data);
|
||||
|
||||
void Platform_getBattery(double *percent, ACPresence *isOnAC);
|
||||
void Platform_getBattery(double* percent, ACPresence* isOnAC);
|
||||
|
||||
static inline void Platform_getHostname(char* buffer, size_t size) {
|
||||
Generic_hostname(buffer, size);
|
||||
|
|
|
@ -20,7 +20,7 @@ in the source distribution for its full text.
|
|||
#include "linux/LinuxProcessList.h"
|
||||
|
||||
|
||||
static const char *HugePageMeter_active_labels[4] = { NULL, NULL, NULL, NULL };
|
||||
static const char* HugePageMeter_active_labels[4] = { NULL, NULL, NULL, NULL };
|
||||
|
||||
static const int HugePageMeter_attributes[] = {
|
||||
HUGEPAGE_1,
|
||||
|
|
|
@ -459,7 +459,7 @@ typedef struct LibraryData_ {
|
|||
bool exec;
|
||||
} LibraryData;
|
||||
|
||||
static inline uint64_t fast_strtoull_dec(char **str, int maxlen) {
|
||||
static inline uint64_t fast_strtoull_dec(char** str, int maxlen) {
|
||||
register uint64_t result = 0;
|
||||
|
||||
if (!maxlen)
|
||||
|
@ -474,7 +474,7 @@ static inline uint64_t fast_strtoull_dec(char **str, int maxlen) {
|
|||
return result;
|
||||
}
|
||||
|
||||
static inline uint64_t fast_strtoull_hex(char **str, int maxlen) {
|
||||
static inline uint64_t fast_strtoull_hex(char** str, int maxlen) {
|
||||
register uint64_t result = 0;
|
||||
register int nibble, letter;
|
||||
const long valid_mask = 0x03FF007E;
|
||||
|
@ -508,8 +508,8 @@ static void LinuxProcessList_calcLibSize_helper(ATTR_UNUSED ht_key_t key, void*
|
|||
if (!value)
|
||||
return;
|
||||
|
||||
const LibraryData* v = (const LibraryData *)value;
|
||||
uint64_t* d = (uint64_t *)data;
|
||||
const LibraryData* v = (const LibraryData*)value;
|
||||
uint64_t* d = (uint64_t*)data;
|
||||
if (!v->exec)
|
||||
return;
|
||||
|
||||
|
@ -543,7 +543,7 @@ static void LinuxProcessList_readMaps(LinuxProcess* process, openat_arg_t procFd
|
|||
continue;
|
||||
|
||||
// Parse format: "%Lx-%Lx %4s %x %2x:%2x %Ld"
|
||||
char *readptr = buffer;
|
||||
char* readptr = buffer;
|
||||
|
||||
map_start = fast_strtoull_hex(&readptr, 16);
|
||||
if ('-' != *readptr++)
|
||||
|
|
|
@ -374,8 +374,8 @@ char* Platform_getProcessEnv(pid_t pid) {
|
|||
*/
|
||||
char* Platform_getInodeFilename(pid_t pid, ino_t inode) {
|
||||
struct stat sb;
|
||||
const struct dirent *de;
|
||||
DIR *dirp;
|
||||
const struct dirent* de;
|
||||
DIR* dirp;
|
||||
ssize_t len;
|
||||
int fd;
|
||||
|
||||
|
|
|
@ -70,13 +70,13 @@ char* Platform_getInodeFilename(pid_t pid, ino_t inode);
|
|||
|
||||
FileLocks_ProcessData* Platform_getProcessLocks(pid_t pid);
|
||||
|
||||
void Platform_getPressureStall(const char *file, bool some, double* ten, double* sixty, double* threehundred);
|
||||
void Platform_getPressureStall(const char* file, bool some, double* ten, double* sixty, double* threehundred);
|
||||
|
||||
bool Platform_getDiskIO(DiskIOData* data);
|
||||
|
||||
bool Platform_getNetworkIO(NetworkIOData* data);
|
||||
|
||||
void Platform_getBattery(double *percent, ACPresence *isOnAC);
|
||||
void Platform_getBattery(double* percent, ACPresence* isOnAC);
|
||||
|
||||
static inline void Platform_getHostname(char* buffer, size_t size) {
|
||||
Generic_hostname(buffer, size);
|
||||
|
|
|
@ -273,7 +273,7 @@ static void PCPProcessList_updateCmdline(Process* process, int pid, int offset,
|
|||
return;
|
||||
}
|
||||
|
||||
char *command = value.cp;
|
||||
char* command = value.cp;
|
||||
int length = strlen(command);
|
||||
if (command[0] != '(') {
|
||||
process->isKernelThread = false;
|
||||
|
@ -472,7 +472,7 @@ static inline void PCPProcessList_backupCPUTime(pmAtomValue* values) {
|
|||
}
|
||||
|
||||
static inline void PCPProcessList_saveCPUTimePeriod(pmAtomValue* values, CPUMetric previous, pmAtomValue* latest) {
|
||||
pmAtomValue *value;
|
||||
pmAtomValue* value;
|
||||
|
||||
/* new value for period */
|
||||
value = &values[previous];
|
||||
|
|
|
@ -56,7 +56,7 @@ bool Platform_getDiskIO(DiskIOData* data);
|
|||
|
||||
bool Platform_getNetworkIO(NetworkIOData* data);
|
||||
|
||||
void Platform_getBattery(double *percent, ACPresence *isOnAC);
|
||||
void Platform_getBattery(double* percent, ACPresence* isOnAC);
|
||||
|
||||
void Platform_getHostname(char* buffer, size_t size);
|
||||
|
||||
|
|
Loading…
Reference in New Issue