summaryrefslogtreecommitdiffstats
path: root/Process.c
diff options
context:
space:
mode:
Diffstat (limited to 'Process.c')
-rw-r--r--Process.c56
1 files changed, 18 insertions, 38 deletions
diff --git a/Process.c b/Process.c
index 9d897604..2a4c809d 100644
--- a/Process.c
+++ b/Process.c
@@ -414,6 +414,8 @@ void Process_makeCommandStr(Process* this) {
bool stripExeFromCmdline = settings->stripExeFromCmdline;
bool showThreadNames = settings->showThreadNames;
+ uint64_t settingsStamp = settings->lastUpdate;
+
/* Nothing to do to (Re)Generate the Command string, if the process is:
* - a kernel thread, or
* - a zombie from before being under htop's watch, or
@@ -422,52 +424,27 @@ void Process_makeCommandStr(Process* this) {
return;
if (this->state == ZOMBIE && !this->mergedCommand.str)
return;
- if (Process_isUserlandThread(this) && settings->showThreadNames && (showThreadNames == mc->prevShowThreadNames) && (mc->prevMergeSet == showMergedCommand))
- return;
/* 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->prevShowThreadNames == showThreadNames &&
- !mc->cmdlineChanged &&
- !mc->commChanged &&
- !mc->exeChanged
- ) {
+ if (mc->lastUpdate >= settingsStamp)
return;
- }
+
+ mc->lastUpdate = settingsStamp;
/* 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 int SEPARATOR_LEN = strlen(SEPARATOR);
- /* Check for any changed fields since we last built this string */
- if (mc->cmdlineChanged || mc->commChanged || mc->exeChanged) {
- free(mc->str);
- /* Accommodate the column text, two field separators and terminating NUL */
- size_t maxLen = 2 * SEPARATOR_LEN + 1;
- maxLen += this->cmdline ? strlen(this->cmdline) : strlen("(zombie)");
- maxLen += this->procComm ? strlen(this->procComm) : 0;
- maxLen += this->procExe ? strlen(this->procExe) : 0;
-
- mc->str = xCalloc(1, maxLen);
- }
-
- /* Preserve the settings used in this run */
- mc->prevMergeSet = showMergedCommand;
- mc->prevPathSet = showProgramPath;
- mc->prevCommSet = searchCommInCmdline;
- mc->prevCmdlineSet = stripExeFromCmdline;
- mc->prevShowThreadNames = showThreadNames;
+ /* Accommodate the column text, two field separators and terminating NUL */
+ size_t maxLen = 2 * SEPARATOR_LEN + 1;
+ maxLen += this->cmdline ? strlen(this->cmdline) : strlen("(zombie)");
+ maxLen += this->procComm ? strlen(this->procComm) : 0;
+ maxLen += this->procExe ? strlen(this->procExe) : 0;
- /* Mark everything as unchanged */
- mc->cmdlineChanged = false;
- mc->commChanged = false;
- mc->exeChanged = false;
+ free(mc->str);
+ mc->str = xCalloc(1, maxLen);
/* Reset all locations that need extra handling when actually displaying */
mc->highlightCount = 0;
@@ -1204,7 +1181,8 @@ void Process_updateComm(Process* this, const char* comm) {
free(this->procComm);
this->procComm = comm ? xStrdup(comm) : NULL;
- this->mergedCommand.commChanged = true;
+
+ this->mergedCommand.lastUpdate = 0;
}
static int skipPotentialPath(const char* cmdline, int end) {
@@ -1244,7 +1222,8 @@ void Process_updateCmdline(Process* this, const char* cmdline, int basenameStart
this->cmdline = cmdline ? xStrdup(cmdline) : NULL;
this->cmdlineBasenameStart = (basenameStart || !cmdline) ? basenameStart : skipPotentialPath(cmdline, basenameEnd);
this->cmdlineBasenameEnd = basenameEnd;
- this->mergedCommand.cmdlineChanged = true;
+
+ this->mergedCommand.lastUpdate = 0;
}
void Process_updateExe(Process* this, const char* exe) {
@@ -1263,7 +1242,8 @@ void Process_updateExe(Process* this, const char* exe) {
this->procExe = NULL;
this->procExeBasenameOffset = 0;
}
- this->mergedCommand.exeChanged = true;
+
+ this->mergedCommand.lastUpdate = 0;
}
uint8_t Process_fieldWidths[LAST_PROCESSFIELD] = { 0 };
d2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
<?php $TRANSLATIONS = array(
"Can not add feed: Exists already" => "Can not add feed: Exists already",
"Can not add feed: URL does not exist, SSL Certificate can not be validated or feed has invalid xml" => "Can not add feed: URL does not exist, SSL Certificate can not be validated or feed has invalid XML",
"Articles without feed" => "Articles without feed",
"Can not add folder: Exists already" => "Can not add folder: Exists already",
" " => " ",
"_" => "_",
"status" => "status",
"Undo deletion of %s" => "Undo deletion of %s",
"News" => "News",
"Add Website" => "Add Website",
"Error: address exists already!" => "Error: address exists already!",
"Error: folder exists already" => "Error: folder exists already",
"Address" => "Address",
"Add" => "Add",
"New folder" => "New folder",
"Folder" => "Folder",
"Choose folder" => "Choose folder",
"Folder name" => "Folder name",
"Back to folder selection" => "Back to folder selection",
"Create folder" => "Create folder",
"Starred" => "Starred",
"Unread articles" => "Unread articles",
"All articles" => "All articles",
"Mark read" => "Mark read",
"Welcome to the ownCloud News app!" => "Welcome to the ownCloud News app!",
"read on website" => "read on website",
"star" => "star",
"from" => "from",
"by" => "by",
"Download" => "Download",
"Keep unread" => "Keep unread",
"Cancel" => "Cancel",
"Save" => "Save",
"Delete website" => "Delete website",
"Rename feed" => "Rename feed",
"Collapse" => "Collapse",
"Delete folder" => "Delete folder",
"Rename folder" => "Rename folder",
"Settings" => "Settings",
"Use compact view" => "Use compact view",
"Subscriptions (OPML)" => "Subscriptions (OPML)",
"Import" => "Import",
"Export" => "Export",
"Error when importing: file does not contain valid OPML" => "Error when importing: file does not contain valid OPML",
"Unread/Starred Articles" => "Unread/Starred Articles",
"Error when importing: file does not contain valid JSON" => "Error when importing: file does not contain valid JSON",
"Show read articles" => "Show read articles",
"Hide read articles" => "Hide read articles"
);