mirror of https://github.com/xzeldon/htop.git
Whitespace around operators
This commit is contained in:
parent
458749df45
commit
0d85af2872
2
Action.c
2
Action.c
|
@ -378,7 +378,7 @@ static Htop_Reaction actionSetup(State* st) {
|
|||
Action_runSetup(st);
|
||||
int headerHeight = Header_calculateHeight(st->header);
|
||||
Panel_move((Panel*)st->mainPanel, 0, headerHeight);
|
||||
Panel_resize((Panel*)st->mainPanel, COLS, LINES-headerHeight-1);
|
||||
Panel_resize((Panel*)st->mainPanel, COLS, LINES - headerHeight - 1);
|
||||
return HTOP_REFRESH | HTOP_REDRAW_BAR | HTOP_UPDATE_PANELHDR;
|
||||
}
|
||||
|
||||
|
|
|
@ -118,10 +118,10 @@ static CommandLineSettings parseArguments(const char* program, int argc, char**
|
|||
{"highlight-changes", optional_argument, 0, 'H'},
|
||||
{"readonly", no_argument, 0, 128},
|
||||
PLATFORM_LONG_OPTIONS
|
||||
{0,0,0,0}
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
int opt, opti=0;
|
||||
int opt, opti = 0;
|
||||
/* Parse arguments */
|
||||
while ((opt = getopt_long(argc, argv, "hVMCs:td:u::Up:F:H::", long_opts, &opti))) {
|
||||
if (opt == EOF)
|
||||
|
@ -355,7 +355,7 @@ int CommandLine_run(const char* name, int argc, char** argv) {
|
|||
ScreenManager_run(scr, NULL, NULL);
|
||||
|
||||
attron(CRT_colors[RESET_COLOR]);
|
||||
mvhline(LINES-1, 0, ' ', COLS);
|
||||
mvhline(LINES - 1, 0, ' ', COLS);
|
||||
attroff(CRT_colors[RESET_COLOR]);
|
||||
refresh();
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ DisplayOptionsPanel* DisplayOptionsPanel_new(Settings* settings, ScreenManager*
|
|||
Panel_add(super, (Object*) CheckItem_newByRef("Enable the mouse", &(settings->enableMouse)));
|
||||
Panel_add(super, (Object*) NumberItem_newByRef("Update interval (in seconds)", &(settings->delay), -1, 1, 255));
|
||||
Panel_add(super, (Object*) CheckItem_newByRef("Highlight new and old processes", &(settings->highlightChanges)));
|
||||
Panel_add(super, (Object*) NumberItem_newByRef("- Highlight time (in seconds)", &(settings->highlightDelaySecs), 0, 1, 24*60*60));
|
||||
Panel_add(super, (Object*) NumberItem_newByRef("- Highlight time (in seconds)", &(settings->highlightDelaySecs), 0, 1, 24 * 60 * 60));
|
||||
Panel_add(super, (Object*) NumberItem_newByRef("Hide main function bar (0 - off, 1 - on ESC until next input, 2 - permanently)", &(settings->hideFunctionBar), 0, 0, 2));
|
||||
#ifdef HAVE_LIBHWLOC
|
||||
Panel_add(super, (Object*) CheckItem_newByRef("Show topology when selecting affinity by default", &(settings->topologyAffinity)));
|
||||
|
|
|
@ -90,7 +90,7 @@ static void DynamicMeter_getUiName(const Meter* this, char* name, size_t length)
|
|||
const char* uiName = meter->caption;
|
||||
if (uiName) {
|
||||
int len = strlen(uiName);
|
||||
if (len > 2 && uiName[len-2] == ':')
|
||||
if (len > 2 && uiName[len - 2] == ':')
|
||||
len -= 2;
|
||||
xSnprintf(name, length, "%.*s", len, uiName);
|
||||
} else {
|
||||
|
|
2
Meter.c
2
Meter.c
|
@ -376,7 +376,7 @@ static const char* const* LEDMeterMode_digits;
|
|||
|
||||
static void LEDMeterMode_drawDigit(int x, int y, int n) {
|
||||
for (int i = 0; i < 3; i++)
|
||||
mvaddstr(y+i, x, LEDMeterMode_digits[i * 10 + n]);
|
||||
mvaddstr(y + i, x, LEDMeterMode_digits[i * 10 + n]);
|
||||
}
|
||||
|
||||
static void LEDMeterMode_draw(Meter* this, int x, int y, ATTR_UNUSED int w) {
|
||||
|
|
2
Panel.c
2
Panel.c
|
@ -454,7 +454,7 @@ HandlerResult Panel_selectByTyping(Panel* this, int ch) {
|
|||
|
||||
if (len < 99) {
|
||||
buffer[len] = ch;
|
||||
buffer[len+1] = '\0';
|
||||
buffer[len + 1] = '\0';
|
||||
}
|
||||
|
||||
for (int try = 0; try < 2; try++) {
|
||||
|
|
32
Process.c
32
Process.c
|
@ -75,7 +75,7 @@ void Process_printBytes(RichString* str, unsigned long long number, bool colorin
|
|||
RichString_appendnAscii(str, processColor, buffer, len);
|
||||
} else if (number < 100000) {
|
||||
//2 digit MB, 3 digit KB
|
||||
len = xSnprintf(buffer, sizeof(buffer), "%2llu", number/1000);
|
||||
len = xSnprintf(buffer, sizeof(buffer), "%2llu", number / 1000);
|
||||
RichString_appendnAscii(str, processMegabytesColor, buffer, len);
|
||||
number %= 1000;
|
||||
len = xSnprintf(buffer, sizeof(buffer), "%03llu ", number);
|
||||
|
@ -88,7 +88,7 @@ void Process_printBytes(RichString* str, unsigned long long number, bool colorin
|
|||
} else if (number < 10000 * ONE_K) {
|
||||
//1 digit GB, 3 digit MB
|
||||
number /= ONE_K;
|
||||
len = xSnprintf(buffer, sizeof(buffer), "%1llu", number/1000);
|
||||
len = xSnprintf(buffer, sizeof(buffer), "%1llu", number / 1000);
|
||||
RichString_appendnAscii(str, processGigabytesColor, buffer, len);
|
||||
number %= 1000;
|
||||
len = xSnprintf(buffer, sizeof(buffer), "%03lluM ", number);
|
||||
|
@ -96,7 +96,7 @@ void Process_printBytes(RichString* str, unsigned long long number, bool colorin
|
|||
} else if (number < 100000 * ONE_K) {
|
||||
//2 digit GB, 1 digit MB
|
||||
number /= 100 * ONE_K;
|
||||
len = xSnprintf(buffer, sizeof(buffer), "%2llu", number/10);
|
||||
len = xSnprintf(buffer, sizeof(buffer), "%2llu", number / 10);
|
||||
RichString_appendnAscii(str, processGigabytesColor, buffer, len);
|
||||
number %= 10;
|
||||
len = xSnprintf(buffer, sizeof(buffer), ".%1llu", number);
|
||||
|
@ -110,7 +110,7 @@ void Process_printBytes(RichString* str, unsigned long long number, bool colorin
|
|||
} else if (number < 10000ULL * ONE_M) {
|
||||
//1 digit TB, 3 digit GB
|
||||
number /= ONE_M;
|
||||
len = xSnprintf(buffer, sizeof(buffer), "%1llu", number/1000);
|
||||
len = xSnprintf(buffer, sizeof(buffer), "%1llu", number / 1000);
|
||||
RichString_appendnAscii(str, largeNumberColor, buffer, len);
|
||||
number %= 1000;
|
||||
len = xSnprintf(buffer, sizeof(buffer), "%03lluG ", number);
|
||||
|
@ -118,7 +118,7 @@ void Process_printBytes(RichString* str, unsigned long long number, bool colorin
|
|||
} else if (number < 100000 * ONE_M) {
|
||||
//2 digit TB, 1 digit GB
|
||||
number /= 100 * ONE_M;
|
||||
len = xSnprintf(buffer, sizeof(buffer), "%2llu", number/10);
|
||||
len = xSnprintf(buffer, sizeof(buffer), "%2llu", number / 10);
|
||||
RichString_appendnAscii(str, largeNumberColor, buffer, len);
|
||||
number %= 10;
|
||||
len = xSnprintf(buffer, sizeof(buffer), ".%1llu", number);
|
||||
|
@ -131,7 +131,7 @@ void Process_printBytes(RichString* str, unsigned long long number, bool colorin
|
|||
RichString_appendnAscii(str, largeNumberColor, buffer, len);
|
||||
} else {
|
||||
//2 digit PB and above
|
||||
len = xSnprintf(buffer, sizeof(buffer), "%4.1lfP ", (double)number/ONE_T);
|
||||
len = xSnprintf(buffer, sizeof(buffer), "%4.1lfP ", (double)number / ONE_T);
|
||||
RichString_appendnAscii(str, largeNumberColor, buffer, len);
|
||||
}
|
||||
}
|
||||
|
@ -159,18 +159,18 @@ void Process_printCount(RichString* str, unsigned long long number, bool colorin
|
|||
} else if (number >= 100LL * ONE_DECIMAL_T) {
|
||||
xSnprintf(buffer, sizeof(buffer), "%11llu ", number / ONE_DECIMAL_M);
|
||||
RichString_appendnAscii(str, largeNumberColor, buffer, 8);
|
||||
RichString_appendnAscii(str, processMegabytesColor, buffer+8, 4);
|
||||
RichString_appendnAscii(str, processMegabytesColor, buffer + 8, 4);
|
||||
} else if (number >= 10LL * ONE_DECIMAL_G) {
|
||||
xSnprintf(buffer, sizeof(buffer), "%11llu ", number / ONE_DECIMAL_K);
|
||||
RichString_appendnAscii(str, largeNumberColor, buffer, 5);
|
||||
RichString_appendnAscii(str, processMegabytesColor, buffer+5, 3);
|
||||
RichString_appendnAscii(str, processColor, buffer+8, 4);
|
||||
RichString_appendnAscii(str, processMegabytesColor, buffer + 5, 3);
|
||||
RichString_appendnAscii(str, processColor, buffer + 8, 4);
|
||||
} else {
|
||||
xSnprintf(buffer, sizeof(buffer), "%11llu ", number);
|
||||
RichString_appendnAscii(str, largeNumberColor, buffer, 2);
|
||||
RichString_appendnAscii(str, processMegabytesColor, buffer+2, 3);
|
||||
RichString_appendnAscii(str, processColor, buffer+5, 3);
|
||||
RichString_appendnAscii(str, processShadowColor, buffer+8, 4);
|
||||
RichString_appendnAscii(str, processMegabytesColor, buffer + 2, 3);
|
||||
RichString_appendnAscii(str, processColor, buffer + 5, 3);
|
||||
RichString_appendnAscii(str, processShadowColor, buffer + 8, 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -728,7 +728,7 @@ void Process_writeField(const Process* this, RichString* str, ProcessField field
|
|||
|
||||
for (int i = 0; i < 32; i++) {
|
||||
if (indent & (1U << i)) {
|
||||
maxIndent = i+1;
|
||||
maxIndent = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1170,15 +1170,15 @@ static int skipPotentialPath(const char* cmdline, int end) {
|
|||
|
||||
int slash = 0;
|
||||
for (int i = 1; i < end; i++) {
|
||||
if (cmdline[i] == '/' && cmdline[i+1] != '\0') {
|
||||
if (cmdline[i] == '/' && cmdline[i + 1] != '\0') {
|
||||
slash = i + 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cmdline[i] == ' ' && cmdline[i-1] != '\\')
|
||||
if (cmdline[i] == ' ' && cmdline[i - 1] != '\\')
|
||||
return slash;
|
||||
|
||||
if (cmdline[i] == ':' && cmdline[i+1] == ' ')
|
||||
if (cmdline[i] == ':' && cmdline[i + 1] == ' ')
|
||||
return slash;
|
||||
}
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ static bool Settings_read(Settings* this, const char* fileName, unsigned int ini
|
|||
} else if (String_eq(option[0], "highlight_changes")) {
|
||||
this->highlightChanges = atoi(option[1]);
|
||||
} else if (String_eq(option[0], "highlight_changes_delay_secs")) {
|
||||
this->highlightDelaySecs = CLAMP(atoi(option[1]), 1, 24*60*60);
|
||||
this->highlightDelaySecs = CLAMP(atoi(option[1]), 1, 24 * 60 * 60);
|
||||
} else if (String_eq(option[0], "find_comm_in_cmdline")) {
|
||||
this->findCommInCmdline = atoi(option[1]);
|
||||
} else if (String_eq(option[0], "strip_exe_from_cmdline")) {
|
||||
|
|
|
@ -182,8 +182,8 @@ static void NetBSDProcessList_updateProcessName(kvm_t* kd, const struct kinfo_pr
|
|||
end = MINIMUM(n, len - 1);
|
||||
/* check if cmdline ended earlier, e.g 'kdeinit5: Running...' */
|
||||
for (int j = end; j > 0; j--) {
|
||||
if (arg[0][j] == ' ' && arg[0][j-1] != '\\') {
|
||||
end = (arg[0][j-1] == ':') ? (j-1) : j;
|
||||
if (arg[0][j] == ' ' && arg[0][j - 1] != '\\') {
|
||||
end = (arg[0][j - 1] == ':') ? (j - 1) : j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -226,8 +226,8 @@ static void OpenBSDProcessList_updateProcessName(kvm_t* kd, const struct kinfo_p
|
|||
end = MINIMUM(n, len - 1);
|
||||
/* check if cmdline ended earlier, e.g 'kdeinit5: Running...' */
|
||||
for (int j = end; j > 0; j--) {
|
||||
if (arg[0][j] == ' ' && arg[0][j-1] != '\\') {
|
||||
end = (arg[0][j-1] == ':') ? (j-1) : j;
|
||||
if (arg[0][j] == ' ' && arg[0][j - 1] != '\\') {
|
||||
end = (arg[0][j - 1] == ':') ? (j - 1) : j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ static PCPDynamicMetric* PCPDynamicMeter_lookupMetric(PCPDynamicMeters* meters,
|
|||
unsigned int n = meter->totalMetrics + 1;
|
||||
meter->metrics = xReallocArray(meter->metrics, n, sizeof(PCPDynamicMetric));
|
||||
meter->totalMetrics = n;
|
||||
metric = &meter->metrics[n-1];
|
||||
metric = &meter->metrics[n - 1];
|
||||
memset(metric, 0, sizeof(PCPDynamicMetric));
|
||||
metric->name = metricName;
|
||||
metric->label = String_cat(name, ": ");
|
||||
|
@ -186,11 +186,11 @@ static void PCPDynamicMeter_parseFile(PCPDynamicMeters* meters, const char* path
|
|||
char* key = String_trim(config[0]);
|
||||
char* value = n > 1 ? String_trim(config[1]) : NULL;
|
||||
if (key[0] == '[') { /* new section heading - i.e. new meter */
|
||||
ok = PCPDynamicMeter_validateMeterName(key+1, path, lineno);
|
||||
ok = PCPDynamicMeter_validateMeterName(key + 1, path, lineno);
|
||||
if (ok)
|
||||
ok = PCPDynamicMeter_uniqueName(key+1, path, lineno, meters);
|
||||
ok = PCPDynamicMeter_uniqueName(key + 1, path, lineno, meters);
|
||||
if (ok)
|
||||
meter = PCPDynamicMeter_new(meters, key+1);
|
||||
meter = PCPDynamicMeter_new(meters, key + 1);
|
||||
} else if (!ok) {
|
||||
; /* skip this one, we're looking for a new header */
|
||||
} else if (value && meter && String_eq(key, "caption")) {
|
||||
|
|
|
@ -280,7 +280,7 @@ static void PCPProcessList_updateCmdline(Process* process, int pid, int offset,
|
|||
} else {
|
||||
++command;
|
||||
--length;
|
||||
if (command[length-1] == ')')
|
||||
if (command[length - 1] == ')')
|
||||
command[--length] = '\0';
|
||||
process->isKernelThread = true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue