Spacing after keywords (while)

This commit is contained in:
Benny Baumann 2020-10-31 20:39:01 +01:00
parent 1877325329
commit 0a51eae11f
5 changed files with 14 additions and 14 deletions

View File

@ -61,7 +61,7 @@ struct Panel_ {
int selectionColor; int selectionColor;
}; };
#define Panel_setDefaultBar(this_) do { (this_)->currentBar = (this_)->defaultBar; } while(0) #define Panel_setDefaultBar(this_) do { (this_)->currentBar = (this_)->defaultBar; } while (0)
#define KEY_CTRL(l) ((l)-'A'+1) #define KEY_CTRL(l) ((l)-'A'+1)

View File

@ -23,13 +23,13 @@ in the source distribution for its full text.
#define RichString_printVal(this, y, x) mvadd_wchstr(y, x, (this).chptr) #define RichString_printVal(this, y, x) mvadd_wchstr(y, x, (this).chptr)
#define RichString_printoffnVal(this, y, x, off, n) mvadd_wchnstr(y, x, (this).chptr + (off), n) #define RichString_printoffnVal(this, y, x, off, n) mvadd_wchnstr(y, x, (this).chptr + (off), n)
#define RichString_getCharVal(this, i) ((this).chptr[i].chars[0] & 255) #define RichString_getCharVal(this, i) ((this).chptr[i].chars[0] & 255)
#define RichString_setChar(this, at, ch) do { (this)->chptr[(at)] = (CharType) { .chars = { ch, 0 } }; } while(0) #define RichString_setChar(this, at, ch) do { (this)->chptr[(at)] = (CharType) { .chars = { ch, 0 } }; } while (0)
#define CharType cchar_t #define CharType cchar_t
#else #else
#define RichString_printVal(this, y, x) mvaddchstr(y, x, (this).chptr) #define RichString_printVal(this, y, x) mvaddchstr(y, x, (this).chptr)
#define RichString_printoffnVal(this, y, x, off, n) mvaddchnstr(y, x, (this).chptr + (off), n) #define RichString_printoffnVal(this, y, x, off, n) mvaddchnstr(y, x, (this).chptr + (off), n)
#define RichString_getCharVal(this, i) ((this).chptr[i]) #define RichString_getCharVal(this, i) ((this).chptr[i])
#define RichString_setChar(this, at, ch) do { (this)->chptr[(at)] = ch; } while(0) #define RichString_setChar(this, at, ch) do { (this)->chptr[(at)] = ch; } while (0)
#define CharType chtype #define CharType chtype
#endif #endif

View File

@ -286,7 +286,7 @@ char* Platform_getProcessEnv(pid_t pid) {
p = strchr(p, 0)+1; p = strchr(p, 0)+1;
// skip padding // skip padding
while(!*p && p < endp) while (!*p && p < endp)
++p; ++p;
// skip argv // skip argv
@ -294,7 +294,7 @@ char* Platform_getProcessEnv(pid_t pid) {
; ;
// skip padding // skip padding
while(!*p && p < endp) while (!*p && p < endp)
++p; ++p;
size_t size = endp - p; size_t size = endp - p;

4
htop.c
View File

@ -190,7 +190,7 @@ static CommandLineSettings parseArguments(int argc, char** argv) {
flags.pidMatchList = Hashtable_new(8, false); flags.pidMatchList = Hashtable_new(8, false);
} }
while(pid) { while (pid) {
unsigned int num_pid = atoi(pid); unsigned int num_pid = atoi(pid);
// deepcode ignore CastIntegerToAddress: we just want a non-NUll pointer here // deepcode ignore CastIntegerToAddress: we just want a non-NUll pointer here
Hashtable_put(flags.pidMatchList, num_pid, (void *) 1); Hashtable_put(flags.pidMatchList, num_pid, (void *) 1);
@ -218,7 +218,7 @@ static void millisleep(unsigned long millisec) {
.tv_sec = 0, .tv_sec = 0,
.tv_nsec = millisec * 1000000L .tv_nsec = millisec * 1000000L
}; };
while(nanosleep(&req,&req)==-1) { while (nanosleep(&req,&req)==-1) {
continue; continue;
} }
} }

View File

@ -165,7 +165,7 @@ static int LinuxProcessList_computeCPUcount(void) {
int cpus = 0; int cpus = 0;
char buffer[PROC_LINE_LENGTH + 1]; char buffer[PROC_LINE_LENGTH + 1];
while(fgets(buffer, sizeof(buffer), file)) { while (fgets(buffer, sizeof(buffer), file)) {
if (String_startsWith(buffer, "cpu")) if (String_startsWith(buffer, "cpu"))
cpus++; cpus++;
} }
@ -221,7 +221,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui
if (statfile == NULL) if (statfile == NULL)
CRT_fatalError("Cannot open " PROCSTATFILE); CRT_fatalError("Cannot open " PROCSTATFILE);
while(true) { while (true) {
char buffer[PROC_LINE_LENGTH + 1]; char buffer[PROC_LINE_LENGTH + 1];
if (fgets(buffer, sizeof(buffer), statfile) == NULL) { if (fgets(buffer, sizeof(buffer), statfile) == NULL) {
CRT_fatalError("No btime in " PROCSTATFILE); CRT_fatalError("No btime in " PROCSTATFILE);
@ -498,7 +498,7 @@ static bool LinuxProcessList_readSmapsFile(LinuxProcess* process, const char* di
while (fgets(buffer, sizeof(buffer), f)) { while (fgets(buffer, sizeof(buffer), f)) {
if(!strchr(buffer, '\n')) { if(!strchr(buffer, '\n')) {
// Partial line, skip to end of this line // Partial line, skip to end of this line
while(fgets(buffer, sizeof(buffer), f)) { while (fgets(buffer, sizeof(buffer), f)) {
if(strchr(buffer, '\n')) { if(strchr(buffer, '\n')) {
break; break;
} }
@ -542,10 +542,10 @@ static void LinuxProcessList_readOpenVZData(LinuxProcess* process, const char* d
bool foundEnvID = false; bool foundEnvID = false;
bool foundVPid = false; bool foundVPid = false;
char linebuf[256]; char linebuf[256];
while(fgets(linebuf, sizeof(linebuf), file) != NULL) { while (fgets(linebuf, sizeof(linebuf), file) != NULL) {
if(strchr(linebuf, '\n') == NULL) { if(strchr(linebuf, '\n') == NULL) {
// Partial line, skip to end of this line // Partial line, skip to end of this line
while(fgets(linebuf, sizeof(linebuf), file) != NULL) { while (fgets(linebuf, sizeof(linebuf), file) != NULL) {
if(strchr(linebuf, '\n') != NULL) { if(strchr(linebuf, '\n') != NULL) {
break; break;
} }
@ -569,11 +569,11 @@ static void LinuxProcessList_readOpenVZData(LinuxProcess* process, const char* d
do { do {
name_value_sep++; name_value_sep++;
} while(*name_value_sep != '\0' && *name_value_sep <= 32); } while (*name_value_sep != '\0' && *name_value_sep <= 32);
char* value_end = name_value_sep; char* value_end = name_value_sep;
while(*value_end != '\0' && *value_end > 32) { while (*value_end != '\0' && *value_end > 32) {
value_end++; value_end++;
} }