mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
Declare for loop variables inside the loop
This commit is contained in:
parent
7ff654f2df
commit
e103ec0317
@ -187,8 +187,8 @@ static inline void Process_writeCommand(const Process* this, int attr, int basea
|
||||
const char* comm = this->comm;
|
||||
|
||||
if (this->settings->highlightBaseName || !this->settings->showProgramPath) {
|
||||
int i, basename = 0;
|
||||
for (i = 0; i < this->basenameOffset; i++) {
|
||||
int basename = 0;
|
||||
for (int i = 0; i < this->basenameOffset; i++) {
|
||||
if (comm[i] == '/') {
|
||||
basename = i + 1;
|
||||
} else if (comm[i] == ':') {
|
||||
|
@ -198,12 +198,11 @@ static bool findCommInCmdline(const char *comm, const char *cmdline, int cmdline
|
||||
/* 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 *token;
|
||||
const char *tokenBase;
|
||||
size_t tokenLen;
|
||||
const size_t commLen = strlen(comm);
|
||||
|
||||
for (token = cmdline + cmdlineBasenameOffset; *token; ) {
|
||||
for (const char *token = cmdline + cmdlineBasenameOffset; *token; ) {
|
||||
for (tokenBase = token; *token && *token != '\n'; ++token) {
|
||||
if (*token == '/') {
|
||||
tokenBase = token + 1;
|
||||
|
Loading…
Reference in New Issue
Block a user