Remove duplicate field LinuxProcess->procCmdlineBasenameEnd

This field held practically the same value as cmdlineBasenameEnd
This commit is contained in:
Benny Baumann 2021-02-02 00:13:19 +01:00 committed by BenBE
parent a685661866
commit 6dc485dd20
3 changed files with 2 additions and 6 deletions

View File

@ -392,7 +392,7 @@ void LinuxProcess_makeCommandStr(Process* this) {
char *str = strStart;
int cmdlineBasenameOffset = lp->procCmdlineBasenameOffset;
int cmdlineBasenameEnd = lp->procCmdlineBasenameEnd;
int cmdlineBasenameEnd = this->cmdlineBasenameOffset;
if (!cmdline) {
cmdlineBasenameOffset = 0;

View File

@ -64,7 +64,6 @@ typedef struct LinuxProcessMergedCommand_ {
typedef struct LinuxProcess_ {
Process super;
int procCmdlineBasenameOffset;
int procCmdlineBasenameEnd;
LinuxProcessMergedCommand mergedCommand;
bool isKernelThread;
IOPriority ioPriority;

View File

@ -1133,10 +1133,9 @@ static bool LinuxProcessList_readCmdlineFile(Process* process, openat_arg_t proc
LinuxProcess *lp = (LinuxProcess *)process;
lp->mergedCommand.maxLen = lastChar + 1; /* accommodate cmdline */
if (!process->cmdline || !String_eq(command, process->cmdline)) {
process->cmdlineBasenameOffset = tokenEnd;
free_and_xStrdup(&process->cmdline, command);
lp->procCmdlineBasenameOffset = tokenStart;
lp->procCmdlineBasenameEnd = tokenEnd;
process->cmdlineBasenameOffset = tokenEnd;
lp->mergedCommand.cmdlineChanged = true;
}
@ -1465,14 +1464,12 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_
proc->cmdlineBasenameOffset = -1;
free_and_xStrdup(&proc->cmdline, command);
lp->procCmdlineBasenameOffset = 0;
lp->procCmdlineBasenameEnd = 0;
lp->mergedCommand.commChanged = true;
} else if (Process_isThread(proc)) {
if (settings->showThreadNames || Process_isKernelThread(proc)) {
proc->cmdlineBasenameOffset = -1;
free_and_xStrdup(&proc->cmdline, command);
lp->procCmdlineBasenameOffset = 0;
lp->procCmdlineBasenameEnd = 0;
lp->mergedCommand.commChanged = true;
}