diff options
74 files changed, 784 insertions, 765 deletions
@@ -59,7 +59,7 @@ Object* Action_pickFromVector(State* st, Panel* list, int x, bool followProcess) } ScreenManager_delete(scr); Panel_move(panel, 0, y); - Panel_resize(panel, COLS, LINES-y-1); + Panel_resize(panel, COLS, LINES - y - 1); if (panelFocus == list && ch == 13) { if (followProcess) { Process* selected = (Process*)Panel_getSelected(panel); @@ -181,7 +181,7 @@ static Htop_Reaction sortBy(State* st) { static Htop_Reaction actionResize(State* st) { clear(); - Panel_resize(st->panel, COLS, LINES-(st->panel->y)-1); + Panel_resize(st->panel, COLS, LINES - (st->panel->y) - 1); return HTOP_REDRAW_BAR; } @@ -393,12 +393,12 @@ static Htop_Reaction actionTag(State* st) { return HTOP_OK; } -static Htop_Reaction actionRedraw(ATTR_UNUSED State *st) { +static Htop_Reaction actionRedraw(ATTR_UNUSED State* st) { clear(); return HTOP_REFRESH | HTOP_REDRAW_BAR; } -static Htop_Reaction actionTogglePauseProcessUpdate(State *st) { +static Htop_Reaction actionTogglePauseProcessUpdate(State* st) { st->pauseProcessUpdate = !st->pauseProcessUpdate; return HTOP_REFRESH | HTOP_REDRAW_BAR; } @@ -454,7 +454,7 @@ static Htop_Reaction actionHelp(State* st) { clear(); attrset(CRT_colors[HELP_BOLD]); - for (int i = 0; i < LINES-1; i++) + for (int i = 0; i < LINES - 1; i++) mvhline(i, 0, ' ', COLS); int line = 0; @@ -500,7 +500,7 @@ static Htop_Reaction actionHelp(State* st) { addattrstr(CRT_colors[BAR_SHADOW], " used/total"); addattrstr(CRT_colors[BAR_BORDER], "]"); attrset(CRT_colors[DEFAULT_COLOR]); - mvaddstr(line++,0, "Type and layout of header meters are configurable in the setup screen."); + mvaddstr(line++, 0, "Type and layout of header meters are configurable in the setup screen."); if (CRT_colorScheme == COLORSCHEME_MONOCHROME) { mvaddstr(line, 0, "In monochrome, meters display as different chars, in order: |#*@$%&."); } @@ -74,7 +74,7 @@ Affinity* Affinity_get(Process* proc, ProcessList* pl) { } bool Affinity_set(Process* proc, Arg arg) { - Affinity *this = arg.v; + Affinity* this = arg.v; hwloc_cpuset_t cpuset = hwloc_bitmap_alloc(); for (int i = 0; i < this->used; i++) { hwloc_bitmap_set(cpuset, this->cpus[i]); @@ -99,7 +99,7 @@ Affinity* Affinity_get(Process* proc, ProcessList* pl) { } bool Affinity_set(Process* proc, Arg arg) { - Affinity *this = arg.v; + Affinity* this = arg.v; cpu_set_t cpuset; CPU_ZERO(&cpuset); for (int i = 0; i < this->used; i++) { diff --git a/AffinityPanel.c b/AffinityPanel.c index e184d64b..85094b4c 100644 --- a/AffinityPanel.c +++ b/AffinityPanel.c @@ -35,7 +35,7 @@ typedef struct MaskItem_ { char* indent; /* used also as an condition whether this is a tree node */ int value; /* tri-state: 0 - off, 1 - some set, 2 - all set */ int sub_tree; /* tri-state: 0 - no sub-tree, 1 - open sub-tree, 2 - closed sub-tree */ - Vector *children; + Vector* children; #ifdef HAVE_LIBHWLOC bool ownCpuset; hwloc_bitmap_t cpuset; @@ -123,11 +123,11 @@ typedef struct AffinityPanel_ { Panel super; ProcessList* pl; bool topoView; - Vector *cpuids; + Vector* cpuids; unsigned width; #ifdef HAVE_LIBHWLOC - MaskItem *topoRoot; + MaskItem* topoRoot; hwloc_const_cpuset_t allCpuset; hwloc_bitmap_t workCpuset; #endif @@ -262,7 +262,7 @@ static HandlerResult AffinityPanel_eventHandler(Panel* super, int ch) { #ifdef HAVE_LIBHWLOC -static MaskItem *AffinityPanel_addObject(AffinityPanel* this, hwloc_obj_t obj, unsigned indent, MaskItem *parent) { +static MaskItem* AffinityPanel_addObject(AffinityPanel* this, hwloc_obj_t obj, unsigned indent, MaskItem* parent) { const char* type_name = hwloc_obj_type_string(obj->type); const char* index_prefix = "#"; unsigned depth = obj->depth; @@ -294,7 +294,7 @@ static MaskItem *AffinityPanel_addObject(AffinityPanel* this, hwloc_obj_t obj, u xSnprintf(buf, 64, "%s %s%u", type_name, index_prefix, index); - MaskItem *item = MaskItem_newMask(buf, indent_buf, obj->complete_cpuset, false); + MaskItem* item = MaskItem_newMask(buf, indent_buf, obj->complete_cpuset, false); if (parent) Vector_add(parent->children, item); @@ -316,8 +316,8 @@ static MaskItem *AffinityPanel_addObject(AffinityPanel* this, hwloc_obj_t obj, u return item; } -static MaskItem *AffinityPanel_buildTopology(AffinityPanel* this, hwloc_obj_t obj, unsigned indent, MaskItem *parent) { - MaskItem *item = AffinityPanel_addObject(this, obj, indent, parent); +static MaskItem* AffinityPanel_buildTopology(AffinityPanel* this, hwloc_obj_t obj, unsigned indent, MaskItem* parent) { + MaskItem* item = AffinityPanel_addObject(this, obj, indent, parent); if (obj->next_sibling) { indent |= (1u << obj->depth); } else { diff --git a/BatteryMeter.c b/BatteryMeter.c index c91ae997..ac126cea 100644 --- a/BatteryMeter.c +++ b/BatteryMeter.c @@ -21,7 +21,7 @@ static const int BatteryMeter_attributes[] = { BATTERY }; -static void BatteryMeter_updateValues(Meter * this, char *buffer, int len) { +static void BatteryMeter_updateValues(Meter* this, char* buffer, int len) { ACPresence isOnAC; double percent; @@ -149,7 +149,7 @@ static void AllCPUsMeter_getRange(Meter* this, int* start, int* count) { } } -static void CPUMeterCommonInit(Meter *this, int ncol) { +static void CPUMeterCommonInit(Meter* this, int ncol) { int cpus = this->pl->cpuCount; CPUMeterData* data = this->meterData; if (!data) { @@ -162,13 +162,13 @@ static void CPUMeterCommonInit(Meter *this, int ncol) { AllCPUsMeter_getRange(this, &start, &count); for (int i = 0; i < count; i++) { if (!meters[i]) - meters[i] = Meter_new(this->pl, start+i+1, (const MeterClass*) Class(CPUMeter)); + meters[i] = Meter_new(this->pl, start + i + 1, (const MeterClass*) Class(CPUMeter)); Meter_init(meters[i]); } if (this->mode == 0) this->mode = BAR_METERMODE; int h = Meter_modes[this->mode]->h; - this->h = h * ((count + ncol - 1)/ ncol); + this->h = h * ((count + ncol - 1) / ncol); } static void CPUMeterCommonUpdateMode(Meter* this, int mode, int ncol) { @@ -181,7 +181,7 @@ static void CPUMeterCommonUpdateMode(Meter* this, int mode, int ncol) { for (int i = 0; i < count; i++) { Meter_setMode(meters[i], mode); } - this->h = h * ((count + ncol - 1)/ ncol); + this->h = h * ((count + ncol - 1) / ncol); } static void AllCPUsMeter_done(Meter* this) { @@ -232,11 +232,11 @@ static void CPUMeterCommonDraw(Meter* this, int x, int y, int w, int ncol) { Meter** meters = data->meters; int start, count; AllCPUsMeter_getRange(this, &start, &count); - int colwidth = (w-ncol)/ncol + 1; + int colwidth = (w - ncol) / ncol + 1; int diff = (w - (colwidth * ncol)); int nrows = (count + ncol - 1) / ncol; - for (int i = 0; i < count; i++){ - int d = (i/nrows) > diff ? diff : (i / nrows) ; // dynamic spacer + for (int i = 0; i < count; i++) { + int d = (i / nrows) > diff ? diff : (i / nrows); // dynamic spacer int xpos = x + ((i / nrows) * colwidth) + d; int ypos = y + ((i % nrows) * meters[0]->h); meters[i]->draw(meters[i], xpos, ypos, colwidth); @@ -42,7 +42,7 @@ in the source distribution for its full text. #define ColorPairGrayBlack ColorPair(Magenta,Magenta) #define ColorIndexGrayBlack ColorIndex(Magenta,Magenta) -static const char *const CRT_treeStrAscii[TREE_STR_COUNT] = { +static const char* const CRT_treeStrAscii[TREE_STR_COUNT] = { "-", // TREE_STR_HORZ "|", // TREE_STR_VERT "`", // TREE_STR_RTEE @@ -54,7 +54,7 @@ static const char *const CRT_treeStrAscii[TREE_STR_COUNT] = { #ifdef HAVE_LIBNCURSESW -static const char *const CRT_treeStrUtf8[TREE_STR_COUNT] = { +static const char* const CRT_treeStrUtf8[TREE_STR_COUNT] = { "\xe2\x94\x80", // TREE_STR_HORZ ─ "\xe2\x94\x82", // TREE_STR_VERT │ "\xe2\x94\x9c", // TREE_STR_RTEE ├ @@ -70,7 +70,7 @@ bool CRT_utf8 = false; #endif -const char *const *CRT_treeStr = CRT_treeStrAscii; +const char* const* CRT_treeStr = CRT_treeStrAscii; int CRT_delay; @@ -78,82 +78,82 @@ const int* CRT_colors; int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = { [COLORSCHEME_DEFAULT] = { - [RESET_COLOR] = ColorPair(White,Black), - [DEFAULT_COLOR] = ColorPair(White,Black), - [FUNCTION_BAR] = ColorPair(Black,Cyan), - [FUNCTION_KEY] = ColorPair(White,Black), - [PANEL_HEADER_FOCUS] = ColorPair(Black,Green), - [PANEL_HEADER_UNFOCUS] = ColorPair(Black,Green), - [PANEL_SELECTION_FOCUS] = ColorPair(Black,Cyan), - [PANEL_SELECTION_FOLLOW] = ColorPair(Black,Yellow), - [PANEL_SELECTION_UNFOCUS] = ColorPair(Black,White), - [FAILED_SEARCH] = ColorPair(Red,Cyan), - [PAUSED] = A_BOLD | ColorPair(Yellow,Cyan), - [UPTIME] = A_BOLD | ColorPair(Cyan,Black), - [BATTERY] = A_BOLD | ColorPair(Cyan,Black), - [LARGE_NUMBER] = A_BOLD | ColorPair(Red,Black), - [METER_TEXT] = ColorPair(Cyan,Black), - [METER_VALUE] = A_BOLD | ColorPair(Cyan,Black), - [METER_VALUE_ERROR] = A_BOLD | ColorPair(Red,Black), - [METER_VALUE_NOTICE] = A_BOLD | ColorPair(White,Black), - [METER_VALUE_IOREAD] = ColorPair(Green,Black), - [METER_VALUE_IOWRITE] = ColorPair(Blue,Black), - [LED_COLOR] = ColorPair(Green,Black), - [TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black), + [RESET_COLOR] = ColorPair(White, Black), + [DEFAULT_COLOR] = ColorPair(White, Black), + [FUNCTION_BAR] = ColorPair(Black, Cyan), + [FUNCTION_KEY] = ColorPair(White, Black), + [PANEL_HEADER_FOCUS] = ColorPair(Black, Green), + [PANEL_HEADER_UNFOCUS] = ColorPair(Black, Green), + [PANEL_SELECTION_FOCUS] = ColorPair(Black, Cyan), + [PANEL_SELECTION_FOLLOW] = ColorPair(Black, Yellow), + [PANEL_SELECTION_UNFOCUS] = ColorPair(Black, White), + [FAILED_SEARCH] = ColorPair(Red, Cyan), + [PAUSED] = A_BOLD | ColorPair(Yellow, Cyan), + [UPTIME] = A_BOLD | ColorPair(Cyan, Black), + [BATTERY] = A_BOLD | ColorPair(Cyan, Black), + [LARGE_NUMBER] = A_BOLD | ColorPair(Red, Black), + [METER_TEXT] = ColorPair(Cyan, Black), + [METER_VALUE] = A_BOLD | ColorPair(Cyan, Black), + [METER_VALUE_ERROR] = A_BOLD | ColorPair(Red, Black), + [METER_VALUE_NOTICE] = A_BOLD | ColorPair(White, Black), + [METER_VALUE_IOREAD] = ColorPair(Green, Black), + [METER_VALUE_IOWRITE] = ColorPair(Blue, Black), + [LED_COLOR] = ColorPair(Green, Black), + [TASKS_RUNNING] = A_BOLD | ColorPair(Green, Black), [PROCESS] = A_NORMAL, [PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack, - [PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Black), - [PROCESS_MEGABYTES] = ColorPair(Cyan,Black), - [PROCESS_GIGABYTES] = ColorPair(Green,Black), - [PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan,Black), - [PROCESS_TREE] = ColorPair(Cyan,Black), - [PROCESS_R_STATE] = ColorPair(Green,Black), - [PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Black), - [PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black), - [PROCESS_LOW_PRIORITY] = ColorPair(Green,Black), - [PROCESS_THREAD] = ColorPair(Green,Black), - [PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Green,Black), + [PROCESS_TAG] = A_BOLD | ColorPair(Yellow, Black), + [PROCESS_MEGABYTES] = ColorPair(Cyan, Black), + [PROCESS_GIGABYTES] = ColorPair(Green, Black), + [PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan, Black), + [PROCESS_TREE] = ColorPair(Cyan, Black), + [PROCESS_R_STATE] = ColorPair(Green, Black), + [PROCESS_D_STATE] = A_BOLD | ColorPair(Red, Black), + [PROCESS_HIGH_PRIORITY] = ColorPair(Red, Black), + [PROCESS_LOW_PRIORITY] = ColorPair(Green, Black), + [PROCESS_THREAD] = ColorPair(Green, Black), + [PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Green, Black), [BAR_BORDER] = A_BOLD, [BAR_SHADOW] = A_BOLD | ColorPairGrayBlack, - [SWAP] = ColorPair(Red,Black), - [GRAPH_1] = A_BOLD | ColorPair(Cyan,Black), - [GRAPH_2] = ColorPair(Cyan,Black), - [MEMORY_USED] = ColorPair(Green,Black), - [MEMORY_BUFFERS] = ColorPair(Blue,Black), - [MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue,Black), - [MEMORY_CACHE] = ColorPair(Yellow,Black), - [LOAD_AVERAGE_FIFTEEN] = ColorPair(Cyan,Black), - [LOAD_AVERAGE_FIVE] = A_BOLD | ColorPair(Cyan,Black), - [LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(White,Black), + [SWAP] = ColorPair(Red, Black), + [GRAPH_1] = A_BOLD | ColorPair(Cyan, Black), + [GRAPH_2] = ColorPair(Cyan, Black), + [MEMORY_USED] = ColorPair(Green, Black), + [MEMORY_BUFFERS] = ColorPair(Blue, Black), + [MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue, Black), + [MEMORY_CACHE] = ColorPair(Yellow, Black), + [LOAD_AVERAGE_FIFTEEN] = ColorPair(Cyan, Black), + [LOAD_AVERAGE_FIVE] = A_BOLD | ColorPair(Cyan, Black), + [LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(White, Black), [LOAD] = A_BOLD, - [HELP_BOLD] = A_BOLD | ColorPair(Cyan,Black), + [HELP_BOLD] = A_BOLD | ColorPair(Cyan, Black), [CLOCK] = A_BOLD, [DATE] = A_BOLD, [DATETIME] = A_BOLD, - [CHECK_BOX] = ColorPair(Cyan,Black), + [CHECK_BOX] = ColorPair(Cyan, Black), [CHECK_MARK] = A_BOLD, [CHECK_TEXT] = A_NORMAL, [HOSTNAME] = A_BOLD, - [CPU_NICE] = ColorPair(Blue,Black), - [CPU_NICE_TEXT] = A_BOLD | ColorPair(Blue,Black), - [CPU_NORMAL] = ColorPair(Green,Black), - [CPU_SYSTEM] = ColorPair(Red,Black), + [CPU_NICE] = ColorPair(Blue, Black), + [CPU_NICE_TEXT] = A_BOLD | ColorPair(Blue, Black), + [CPU_NORMAL] = ColorPair(Green, Black), + [CPU_SYSTEM] = ColorPair(Red, Black), [CPU_IOWAIT] = A_BOLD | ColorPairGrayBlack, - [CPU_IRQ] = ColorPair(Yellow,Black), - [CPU_SOFTIRQ] = ColorPair(Magenta,Black), - [CPU_STEAL] = ColorPair(Cyan,Black), - [CPU_GUEST] = ColorPair(Cyan,Black), - [PRESSURE_STALL_THREEHUNDRED] = ColorPair(Cyan,Black), - [PRESSURE_STALL_SIXTY] = A_BOLD | ColorPair(Cyan,Black), - [PRESSURE_STALL_TEN] = A_BOLD | ColorPair(White,Black), - [ZFS_MFU] = ColorPair(Blue,Black), - [ZFS_MRU] = ColorPair(Yellow,Black), - [ZFS_ANON] = ColorPair(Magenta,Black), - [ZFS_HEADER] = ColorPair(Cyan,Black), - [ZFS_OTHER] = ColorPair(Magenta,Black), - [ZFS_COMPRESSED] = ColorPair(Blue,Black), - [ZFS_RATIO] = ColorPair(Magenta,Black), - [ZRAM] = ColorPair(Yellow,Black), + [CPU_IRQ] = ColorPair(Yellow, Black), + [CPU_SOFTIRQ] = ColorPair(Magenta, Black), + [CPU_STEAL] = ColorPair(Cyan, Black), + [CPU_GUEST] = ColorPair(Cyan, Black), + [PRESSURE_STALL_THREEHUNDRED] = ColorPair(Cyan, Black), + [PRESSURE_STALL_SIXTY] = A_BOLD | ColorPair(Cyan, Black), + [PRESSURE_STALL_TEN] = A_BOLD | ColorPair(White, Black), + [ZFS_MFU] = ColorPair(Blue, Black), + [ZFS_MRU] = ColorPair(Yellow, Black), + [ZFS_ANON] = ColorPair(Magenta, Black), + [ZFS_HEADER] = ColorPair(Cyan, Black), + [ZFS_OTHER] = ColorPair(Magenta, Black), + [ZFS_COMPRESSED] = ColorPair(Blue, Black), + [ZFS_RATIO] = ColorPair(Magenta, Black), + [ZRAM] = ColorPair(Yellow, Black), }, [COLORSCHEME_MONOCHROME] = { [RESET_COLOR] = A_NORMAL, @@ -234,314 +234,314 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = { [ZRAM] = A_NORMAL, }, [COLORSCHEME_BLACKONWHITE] = { - [RESET_COLOR] = ColorPair(Black,White), - [DEFAULT_COLOR] = ColorPair(Black,White), - [FUNCTION_BAR] = ColorPair(Black,Cyan), - [FUNCTION_KEY] = ColorPair(Black,White), - [PANEL_HEADER_FOCUS] = ColorPair(Black,Green), - [PANEL_HEADER_UNFOCUS] = ColorPair(Black,Green), - [PANEL_SELECTION_FOCUS] = ColorPair(Black,Cyan), - [PANEL_SELECTION_FOLLOW] = ColorPair(Black,Yellow), - [PANEL_SELECTION_UNFOCUS] = ColorPair(Blue,White), - [FAILED_SEARCH] = ColorPair(Red,Cyan), - [PAUSED] = A_BOLD | ColorPair(Yellow,Cyan), - [UPTIME] = ColorPair(Yellow,White), - [BATTERY] = ColorPair(Yellow,White), - [LARGE_NUMBER] = ColorPair(Red,White), - [METER_TEXT] = ColorPair(Blue,White), - [METER_VALUE] = ColorPair(Black,White), - [METER_VALUE_ERROR] = A_BOLD | ColorPair(Red,White), - [METER_VALUE_NOTICE] = A_BOLD | ColorPair(Yellow,White), - [METER_VALUE_IOREAD] = ColorPair(Green,White), - [METER_VALUE_IOWRITE] = ColorPair(Yellow,White), - [LED_COLOR] = ColorPair(Green,White), - [TASKS_RUNNING] = ColorPair(Green,White), - [PROCESS] = ColorPair(Black,White), - [PROCESS_SHADOW] = A_BOLD | ColorPair(Black,White), - [PROCESS_TAG] = ColorPair(White,Blue), - [PROCESS_MEGABYTES] = ColorPair(Blue |