From 0d85af28727255ae4203cf01d1d657dc0c8d4258 Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Wed, 14 Jul 2021 19:18:27 +0200 Subject: Whitespace around operators --- Action.c | 2 +- CommandLine.c | 6 +++--- DisplayOptionsPanel.c | 2 +- DynamicMeter.c | 2 +- Meter.c | 2 +- Panel.c | 2 +- Process.c | 32 ++++++++++++++++---------------- Settings.c | 2 +- netbsd/NetBSDProcessList.c | 4 ++-- openbsd/OpenBSDProcessList.c | 4 ++-- pcp/PCPDynamicMeter.c | 8 ++++---- pcp/PCPProcessList.c | 2 +- 12 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Action.c b/Action.c index 2a580f74..21183e0d 100644 --- a/Action.c +++ b/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; } diff --git a/CommandLine.c b/CommandLine.c index d0c24e58..eebbd947 100644 --- a/CommandLine.c +++ b/CommandLine.c @@ -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(); diff --git a/DisplayOptionsPanel.c b/DisplayOptionsPanel.c index e945edd9..ab80aaa0 100644 --- a/DisplayOptionsPanel.c +++ b/DisplayOptionsPanel.c @@ -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))); diff --git a/DynamicMeter.c b/DynamicMeter.c index 66dde068..44a3b439 100644 --- a/DynamicMeter.c +++ b/DynamicMeter.c @@ -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 { diff --git a/Meter.c b/Meter.c index 5e3a00d0..3e5281c7 100644 --- a/Meter.c +++ b/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) { diff --git a/Panel.c b/Panel.c index 69933aea..dea64019 100644 --- a/Panel.c +++ b/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++) { diff --git a/Process.c b/Process.c index 8ecb6347..bf730c7f 100644 --- a/Process.c +++ b/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; } diff --git a/Settings.c b/Settings.c index acb3edfa..ca8253e2 100644 --- a/Settings.c +++ b/Settings.c @@ -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")) { diff --git a/netbsd/NetBSDProcessList.c b/netbsd/NetBSDProcessList.c index 5c165088..caa8bb0c 100644 --- a/netbsd/NetBSDProcessList.c +++ b/netbsd/NetBSDProcessList.c @@ -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; } } } diff --git a/openbsd/OpenBSDProcessList.c b/openbsd/OpenBSDProcessList.c index 8dc4ac94..76b2aeb7 100644 --- a/openbsd/OpenBSDProcessList.c +++ b/openbsd/OpenBSDProcessList.c @@ -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; } } } diff --git a/pcp/PCPDynamicMeter.c b/pcp/PCPDynamicMeter.c index a6c2ab26..be558ab9 100644 --- a/pcp/PCPDynamicMeter.c +++ b/pcp/PCPDynamicMeter.c @@ -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")) { diff --git a/pcp/PCPProcessList.c b/pcp/PCPProcessList.c index ac72e434..da51c31c 100644 --- a/pcp/PCPProcessList.c +++ b/pcp/PCPProcessList.c @@ -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; } -- cgit v1.2.3