diff options
author | Daniel Flanagan <daniel@lytedev.io> | 2019-10-31 11:39:12 -0500 |
---|---|---|
committer | Daniel Flanagan <daniel@lytedev.io> | 2019-10-31 11:39:12 -0500 |
commit | dd33444f7eace81115308eadb568020470c48b2b (patch) | |
tree | b13c2a7f17cc64458016d396829e95ef5cea9294 | |
parent | 28840683cfc5d48307b9b0f382f55f8c84d6a0c4 (diff) |
Clean up existing whitespace
47 files changed, 155 insertions, 155 deletions
@@ -66,7 +66,7 @@ Object* Action_pickFromVector(State* st, Panel* list, int x) { Panel* panel = st->panel; Header* header = st->header; Settings* settings = st->settings; - + int y = panel->y; ScreenManager* scr = ScreenManager_new(0, header->height, 0, -1, HORIZONTAL, header, settings, false); scr->allowFocusChange = false; @@ -297,7 +297,7 @@ static Htop_Reaction actionSetAffinity(State* st) { return HTOP_OK; #if (HAVE_LIBHWLOC || HAVE_LINUX_AFFINITY) Panel* panel = st->panel; - + Process* p = (Process*) Panel_getSelected(panel); if (!p) return HTOP_OK; Affinity* affinity = Affinity_get(p, st->pl); diff --git a/AvailableMetersPanel.c b/AvailableMetersPanel.c index ddb55367..f670f6b7 100644 --- a/AvailableMetersPanel.c +++ b/AvailableMetersPanel.c @@ -52,7 +52,7 @@ static inline void AvailableMetersPanel_addMeter(Header* header, Panel* panel, M static HandlerResult AvailableMetersPanel_eventHandler(Panel* super, int ch) { AvailableMetersPanel* this = (AvailableMetersPanel*) super; Header* header = this->header; - + ListItem* selected = (ListItem*) Panel_getSelected(super); int param = selected->key & 0xff; int type = selected->key >> 16; @@ -104,7 +104,7 @@ AvailableMetersPanel* AvailableMetersPanel_new(Settings* settings, Header* heade Panel* super = (Panel*) this; FunctionBar* fuBar = FunctionBar_newEnterEsc("Add ", "Done "); Panel_init(super, 1, 1, 1, 1, Class(ListItem), true, fuBar); - + this->settings = settings; this->header = header; this->leftPanel = leftMeters; diff --git a/BatteryMeter.c b/BatteryMeter.c index 214248e2..716b7750 100644 --- a/BatteryMeter.c +++ b/BatteryMeter.c @@ -35,7 +35,7 @@ int BatteryMeter_attributes[] = { static void BatteryMeter_updateValues(Meter * this, char *buffer, int len) { ACPresence isOnAC; double percent; - + Battery_getData(&percent, &isOnAC); if (percent == -1) { @@ -219,7 +219,7 @@ MeterClass CPUMeter_class = { .defaultMode = BAR_METERMODE, .maxItems = CPU_METER_ITEMCOUNT, .total = 100.0, - .attributes = CPUMeter_attributes, + .attributes = CPUMeter_attributes, .name = "CPU", .uiName = "CPU", .caption = "CPU", @@ -234,7 +234,7 @@ MeterClass AllCPUsMeter_class = { }, .defaultMode = CUSTOM_METERMODE, .total = 100.0, - .attributes = CPUMeter_attributes, + .attributes = CPUMeter_attributes, .name = "AllCPUs", .uiName = "CPUs (1/1)", .description = "CPUs (1/1): all CPUs", @@ -253,7 +253,7 @@ MeterClass AllCPUs2Meter_class = { }, .defaultMode = CUSTOM_METERMODE, .total = 100.0, - .attributes = CPUMeter_attributes, + .attributes = CPUMeter_attributes, .name = "AllCPUs2", .uiName = "CPUs (1&2/2)", .description = "CPUs (1&2/2): all CPUs in 2 shorter columns", @@ -272,7 +272,7 @@ MeterClass LeftCPUsMeter_class = { }, .defaultMode = CUSTOM_METERMODE, .total = 100.0, - .attributes = CPUMeter_attributes, + .attributes = CPUMeter_attributes, .name = "LeftCPUs", .uiName = "CPUs (1/2)", .description = "CPUs (1/2): first half of list", @@ -291,7 +291,7 @@ MeterClass RightCPUsMeter_class = { }, .defaultMode = CUSTOM_METERMODE, .total = 100.0, - .attributes = CPUMeter_attributes, + .attributes = CPUMeter_attributes, .name = "RightCPUs", .uiName = "CPUs (2/2)", .description = "CPUs (2/2): second half of list", @@ -310,7 +310,7 @@ MeterClass LeftCPUs2Meter_class = { }, .defaultMode = CUSTOM_METERMODE, .total = 100.0, - .attributes = CPUMeter_attributes, + .attributes = CPUMeter_attributes, .name = "LeftCPUs2", .uiName = "CPUs (1&2/4)", .description = "CPUs (1&2/4): first half in 2 shorter columns", @@ -329,7 +329,7 @@ MeterClass RightCPUs2Meter_class = { }, .defaultMode = CUSTOM_METERMODE, .total = 100.0, - .attributes = CPUMeter_attributes, + .attributes = CPUMeter_attributes, .name = "RightCPUs2", .uiName = "CPUs (3&4/4)", .description = "CPUs (3&4/4): second half in 2 shorter columns", @@ -604,12 +604,12 @@ void CRT_init(int delay, int colorScheme) { } CRT_colors = CRT_colorSchemes[colorScheme]; CRT_colorScheme = colorScheme; - + for (int i = 0; i < LAST_COLORELEMENT; i++) { unsigned int color = CRT_colorSchemes[COLORSCHEME_DEFAULT][i]; CRT_colorSchemes[COLORSCHEME_BROKENGRAY][i] = color == (A_BOLD | ColorPairGrayBlack) ? ColorPair(White,Black) : color; } - + halfdelay(CRT_delay); nonl(); intrflush(stdscr, false); diff --git a/CheckItem.c b/CheckItem.c index b7ba6fec..910981e8 100644 --- a/CheckItem.c +++ b/CheckItem.c @@ -66,14 +66,14 @@ CheckItem* CheckItem_newByVal(char* text, bool value) { } void CheckItem_set(CheckItem* this, bool value) { - if (this->ref) + if (this->ref) *(this->ref) = value; else this->value = value; } bool CheckItem_get(CheckItem* this) { - if (this->ref) + if (this->ref) return *(this->ref); else return this->value; diff --git a/ColorsPanel.c b/ColorsPanel.c index 2028335f..b2d3500c 100644 --- a/ColorsPanel.c +++ b/ColorsPanel.c @@ -56,7 +56,7 @@ static void ColorsPanel_delete(Object* object) { static HandlerResult ColorsPanel_eventHandler(Panel* super, int ch) { ColorsPanel* this = (ColorsPanel*) super; - + HandlerResult result = IGNORED; int mark = Panel_getSelectedIndex(super); diff --git a/ColumnsPanel.c b/ColumnsPanel.c index 8974ffdc..f982292e 100644 --- a/ColumnsPanel.c +++ b/ColumnsPanel.c @@ -40,7 +40,7 @@ static void ColumnsPanel_delete(Object* object) { static HandlerResult ColumnsPanel_eventHandler(Panel* super, int ch) { ColumnsPanel* const this = (ColumnsPanel*) super; - + int selected = Panel_getSelectedIndex(super); HandlerResult result = IGNORED; int size = Panel_size(super); @@ -87,7 +87,7 @@ static HandlerResult ColumnsPanel_eventHandler(Panel* super, int ch) { case ']': case '+': { - if (selected < size - 2) + if (selected < size - 2) Panel_moveSelectedDown(super); result = HANDLED; break; diff --git a/DisplayOptionsPanel.c b/DisplayOptionsPanel.c index 0ff54e33..40b8d987 100644 --- a/DisplayOptionsPanel.c +++ b/DisplayOptionsPanel.c @@ -39,7 +39,7 @@ static void DisplayOptionsPanel_delete(Object* object) { static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) { DisplayOptionsPanel* this = (DisplayOptionsPanel*) super; - + HandlerResult result = IGNORED; CheckItem* selected = (CheckItem*) Panel_getSelected(super); diff --git a/FunctionBar.c b/FunctionBar.c index 4e4baaf3..8661bf0c 100644 --- a/FunctionBar.c +++ b/FunctionBar.c @@ -52,7 +52,7 @@ FunctionBar* FunctionBar_new(const char* const* functions, const char* const* ke this->functions[i] = xStrdup(functions[i]); } if (keys && events) { - this->staticData = false; + this->staticData = false; this->keys = xCalloc(15, sizeof(char*)); this->events = xCalloc(15, sizeof(int)); int i = 0; diff --git a/Hashtable.c b/Hashtable.c index b3eac8da..3436dad6 100644 --- a/Hashtable.c +++ b/Hashtable.c @@ -63,7 +63,7 @@ int Hashtable_count(Hashtable* this) { static HashtableItem* HashtableItem_new(unsigned int key, void* value) { HashtableItem* this; - + this = xMalloc(sizeof(HashtableItem)); this->key = key; this->value = value; @@ -73,7 +73,7 @@ static HashtableItem* HashtableItem_new(unsigned int key, void* value) { Hashtable* Hashtable_new(int size, bool owner) { Hashtable* this; - + this = xMalloc(sizeof(Hashtable)); this->items = 0; this->size = size; @@ -119,10 +119,10 @@ void Hashtable_put(Hashtable* this, unsigned int key, void* value) { void* Hashtable_remove(Hashtable* this, unsigned int key) { unsigned int index = key % this->size; - + assert(Hashtable_isConsistent(this)); - HashtableItem** bucket; + HashtableItem** bucket; for (bucket = &(this->buckets[index]); *bucket; bucket = &((*bucket)->next) ) { if ((*bucket)->key == key) { void* value = (*bucket)->value; @@ -76,17 +76,17 @@ void Header_populateFromSettings(Header* this) { void Header_writeBackToSettings(const Header* this) { Header_forEachColumn(this, col) { MeterColumnSettings* colSettings = &this->settings->columns[col]; - + String_freeArray(colSettings->names); free(colSettings->modes); - + Vector* vec = this->columns[col]; int len = Vector_size(vec); - + colSettings->names = xCalloc(len+1, sizeof(char*)); colSettings->modes = xCalloc(len, sizeof(int)); colSettings->len = len; - + for (int i = 0; i < len; i++) { Meter* meter = (Meter*) Vector_get(vec, i); char* name = xCalloc(64, sizeof(char)); @@ -186,7 +186,7 @@ void Header_draw(const Header* this) { } int width = COLS / this->nrColumns - (pad * this->nrColumns - 1) - 1; int x = pad; - + Header_forEachColumn(this, col) { Vector* meters = this->columns[col]; for (int y = (pad / 2), i = 0; i < Vector_size(meters); i++) { diff --git a/InfoScreen.c b/InfoScreen.c index fab8daea..0e7543a3 100644 --- a/InfoScreen.c +++ b/InfoScreen.c @@ -120,7 +120,7 @@ void InfoScreen_run(InfoScreen* this) { } set_escdelay(25); int ch = getch(); - + if (ch == ERR) { if (As_InfoScreen(this)->onErr) { InfoScreen_onErr(this); @@ -143,7 +143,7 @@ void InfoScreen_run(InfoScreen* this) { IncSet_handleKey(this->inc, ch, panel, IncSet_getListItemValue, this->lines); continue; } - + switch(ch) { case ERR: continue; diff --git a/MainPanel.c b/MainPanel.c index 25023367..b271162a 100644 --- a/MainPanel.c +++ b/MainPanel.c @@ -69,7 +69,7 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) { MainPanel* this = (MainPanel*) super; HandlerResult result = IGNORED; - + Htop_Reaction reaction = HTOP_OK; if (EVENT_IS_HEADER_CLICK(ch)) { @@ -84,7 +84,7 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) { } else { reaction |= Action_setSortKey(settings, field); } - reaction |= HTOP_RECALCULATE | HTOP_REDRAW_BAR | HTOP_SAVE_SETTINGS; + reaction |= HTOP_RECALCULATE | HTOP_REDRAW_BAR | HTOP_SAVE_SETTINGS; result = HANDLED; } else if (ch != ERR && this->inc->active) { bool filterChanged = IncSet_handleKey(this->inc, ch, super, (IncMode_GetPanelValue) MainPanel_getValue, NULL); @@ -121,7 +121,7 @@ static HandlerResult MainPanel_eventHandler(Panel* super, int ch) { } if (reaction & HTOP_REFRESH) { result |= REDRAW; - } + } if (reaction & HTOP_RECALCULATE) { result |= RESCAN; } diff --git a/MemoryMeter.c b/MemoryMeter.c index fbf5330c..8d5d809e 100644 --- a/MemoryMeter.c +++ b/MemoryMeter.c @@ -60,7 +60,7 @@ MeterClass MemoryMeter_class = { .delete = Meter_delete, .display = MemoryMeter_display, }, - .updateValues = MemoryMeter_updateValues, + .updateValues = MemoryMeter_updateValues, .defaultMode = BAR_METERMODE, .maxItems = 3, .total = 100.0, @@ -78,7 +78,7 @@ typedef struct MeterClass_ { struct Meter_ { Object super; Meter_Draw draw; - + char* caption; int mode; int param; @@ -275,7 +275,7 @@ static void BarMeterMode_draw(Meter* this, int x, int y, int w) { attrset(CRT_colors[BAR_BORDER]); mvaddch(y, x, '['); mvaddch(y, x + w, ']'); - + w--; x++; @@ -284,7 +284,7 @@ static void BarMeterMode_draw(Meter* this, int x, int y, int w) { return; } char bar[w + 1]; - + int blockSizes[10]; xSnprintf(bar, w + 1, "%*.*s", w, w, buffer); @@ -378,7 +378,7 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) { mvaddnstr(y, x, this->caption, captionLen); x += captionLen; w -= captionLen; - + struct timeval now; gettimeofday(&now, NULL); if (!timercmp(&now, &(data->time), <)) { @@ -387,10 +387,10 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) { for (int i = 0; i < nValues - 1; i++) data->values[i] = data->values[i+1]; - + char buffer[nValues]; Meter_updateValues(this, buffer, nValues - 1); - + double value = 0.0; int items = Meter_getItems(this); for (int i = 0; i < items; i++) @@ -398,7 +398,7 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) { value /= this->total; data->values[nValues - 1] = value; } - + int i = nValues - (w*2) + 2, k = 0; if (i < 0) { k = -i/2; @@ -459,7 +459,7 @@ static void LEDMeterMode_draw(Meter* this, int x, int y, int w) { char buffer[METER_BUFFER_LEN]; Meter_updateValues(this, buffer, METER_BUFFER_LEN - 1); - + RichString_begin(out); Meter_displayBuffer(this, buffer, &out); @@ -65,7 +65,7 @@ typedef struct MeterClass_ { struct Meter_ { Object super; Meter_Draw draw; - + char* caption; int mode; int param; diff --git a/MetersPanel.c b/MetersPanel.c index 3cf3e075..397a6c7d 100644 --- a/MetersPanel.c +++ b/MetersPanel.c @@ -93,7 +93,7 @@ static inline bool moveToNeighbor(MetersPanel* this, MetersPanel* neighbor, int static HandlerResult MetersPanel_eventHandler(Panel* super, int ch) { MetersPanel* this = (MetersPanel*) super; - + int selected = Panel_getSelectedIndex(super); HandlerResult result = IGNORED; bool sideMove = false; @@ -28,7 +28,7 @@ typedef void(*Object_Delete)(Object*); #define Class(class_) ((ObjectClass*)(&(class_ ## _class))) #define AllocThis(class_) (class_*) xMalloc(sizeof(class_)); Object_setClass(this, Class(class_)); - + typedef struct ObjectClass_ { const void* extends; const Object_Display display; @@ -29,7 +29,7 @@ typedef void(*Object_Delete)(Object*); #define Class(class_) ((ObjectClass*)(&(class_ ## _class))) #define AllocThis(class_) (class_*) xMalloc(sizeof(class_)); Object_setClass(this, Class(class_)); - + typedef struct ObjectClass_ { const void* extends; const Object_Display display; @@ -372,7 +372,7 @@ void Panel_draw(Panel* this, bool focus) { bool Panel_onKey(Panel* this, int key) { assert (this != NULL); - + int size = Vector_size(this->items); switch (key) { case KEY_DOWN: @@ -455,7 +455,7 @@ bool Panel_onKey(Panel* this, int key) { if (this->selected < 0 || size == 0) { this->selected = 0; this->needsRedraw = true; - } else if (this->selected >= size) { + } else if (this->selected >= size) { this->selected = size - 1; this->needsRedraw = true; } @@ -216,7 +216,7 @@ void Process_setupColumnWidths() { void Process_humanNumber(RichString* str, unsigned long number, bool coloring) { char buffer[11]; int len; - + int largeNumberColor = CRT_colors[LARGE_NUMBER]; int processMegabytesColor = CRT_colors[PROCESS_MEGABYTES]; int processColor = CRT_colors[PROCESS]; @@ -224,7 +224,7 @@ void Process_humanNumber(RichString* str, unsigned long number, bool coloring) { largeNumberColor = CRT_colors[PROCESS]; processMegabytesColor = CRT_colors[PROCESS]; } - + if(number >= (10 * ONE_DECIMAL_M)) { #ifdef __LP64__ if(number >= (100 * ONE_DECIMAL_G)) { @@ -380,9 +380,9 @@ void Process_writeField(Process* this, RichString* str, ProcessField field) { switch (field) { case PERCENT_CPU: { if (this->percent_cpu > 999.9) { - xSnprintf(buffer, n, "%4u ", (unsigned int)this->percent_cpu); + xSnprintf(buffer, n, "%4u ", (unsigned int)this->percent_cpu); } else if (this->percent_cpu > 99.9) { - xSnprintf(buffer, n, "%3u. ", (unsigned int)this->percent_cpu); + xSnprintf(buffer, n, "%3u. ", (unsigned int)this->percent_cpu); } else { xSnprintf(buffer, n, "%4.1f ", this->percent_cpu); } @@ -390,7 +390,7 @@ void Process_writeField(Process* this, RichString* str, ProcessField field) { } case PERCENT_MEM: { if (this->percent_mem > 99.9) { - xSnprintf(buffer, n, "100. "); + xSnprintf(buffer, n, "100. "); } else { xSnprintf(buffer, n, "%4.1f ", this->percent_mem); } diff --git a/ProcessList.c b/ProcessList.c index 7482b037..edbc114c 100644 --- a/ProcessList.c +++ b/ProcessList.c @@ -84,10 +84,10 @@ ProcessList* ProcessList_init(ProcessList* this, ObjectClass* klass, UsersTable* this->usersTable = usersTable; this->pidWhiteList = pidWhiteList; this->userId = userId; - + // tree-view auxiliary buffer this->processes2 = Vector_new(klass, true, DEFAULT_SIZE); - + // set later by platform-specific code this->cpuCount = 0; @@ -138,10 +138,10 @@ void ProcessList_printHeader(ProcessList* this, RichString* header) { void ProcessList_add(ProcessList* this, Process* p) { assert(Vector_indexOf(this->processes, p, Process_pidCompare) == -1); assert(Hashtable_get(this->processTable, p->pid) == NULL); - + Vector_add(this->processes, p); Hashtable_put(this->processTable, p->pid, p); - + assert(Vector_indexOf(this->processes, p, Process_pidCompare) != -1); assert(Hashtable_get(this->processTable, p->pid) != NULL); assert(Hashtable_count(this->processTable) == Vector_count(this->processes)); @@ -353,7 +353,7 @@ void ProcessList_scan(ProcessList* this) { this->runningTasks = 0; ProcessList_goThroughEntries(this); - + for (int i = Vector_size(this->processes) - 1; i >= 0; i--) { Process* p = (Process*) Vector_get(this->processes, i); if (p->updated == false) diff --git a/RichString.c b/RichString.c index 370566a8..d246f1e1 100644 --- a/RichString.c +++ b/RichString.c @@ -67,7 +67,7 @@ typedef struct RichString_ { #define CLAMP(x,low,high) (((x)>(high))?(high):(((x)<(low))?(low):(x))) #endif -#define charBytes(n) (sizeof(CharType) * (n)) +#define charBytes(n) (sizeof(CharType) * (n)) static void RichString_extendLen(RichString* this, int len) { if (this->chlen <= RICHSTRING_MAXLEN) { diff --git a/RichString.h b/RichString.h index f5b5cba1..17649d0f 100644 --- a/RichString.h +++ b/RichString.h @@ -63,7 +63,7 @@ typedef struct RichString_ { #define CLAMP(x,low,high) (((x)>(high))?(high):(((x)<(low))?(low):(x))) #endif -#define charBytes(n) (sizeof(CharType) * (n)) +#define charBytes(n) (sizeof(CharType) * (n)) #define RichString_setLen(this, len) do{ if(len < RICHSTRING_MAXLEN && this->chlen < RICHSTRING_MAXLEN) { RichString_setChar(this,len,0); this->chlen=len; } else RichString_extendLen(this,len); }while(0) diff --git a/ScreenManager.c b/ScreenManager.c index 06e90193..54d4ea45 100644 --- a/ScreenManager.c +++ b/ScreenManager.c @@ -163,7 +163,7 @@ static Panel* setCurrentPanel(Panel* panel) { void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) { bool quit = false; int focus = 0; - + Panel* panelFocus = setCurrentPanel((Panel*) Vector_get(this->panels, focus)); double oldTime = 0.0; @@ -181,7 +181,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) { if (this->header) { checkRecalculation(this, &oldTime, &sortTimeout, &redraw, &rescan, &timedOut); } - + if (redraw) { ScreenManager_drawPanels(this, focus); } @@ -269,7 +269,7 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) { quit = true; continue; } - + switch (ch) { case KEY_RESIZE: { @@ -31,7 +31,7 @@ typedef struct { typedef struct Settings_ { char* filename; - + MeterColumnSettings columns[2]; ProcessField* fields; @@ -114,7 +114,7 @@ static void Settings_defaultMeters(Settings* this) { this->columns[i].modes = xCalloc(sizes[i], sizeof(int)); this->columns[i].len = sizes[i]; } - + int r = 0; if (this->cpuCount > 8) { this->columns[0].names[0] = xStrdup("LeftCPUs2"); @@ -134,7 +134,7 @@ static void Settings_defaultMeters(Settings* this) { this->columns[0].modes[1] = BAR_METERMODE; this->columns[0].names[2] = xStrdup("Swap"); this->columns[0].modes[2] = BAR_METERMODE; - + this->columns[1].names[r] = xStrdup("Tasks"); this->columns[1].modes[r++] = TEXT_METERMODE; this->columns[1].names[r] = xStrdup("LoadAverage"); @@ -165,13 +165,13 @@ static void readFields(ProcessField* fields, int* flags, const char* line) { static bool Settings_read(Settings* this, const char* fileName) { FILE* fd; - + CRT_dropPrivileges(); fd = fopen(fileName, "r"); CRT_restoreP |