Skip to content

Commit

Permalink
Spacing around operators
Browse files Browse the repository at this point in the history
  • Loading branch information
BenBE committed Nov 2, 2020
1 parent b23f823 commit 61e14d4
Show file tree
Hide file tree
Showing 74 changed files with 784 additions and 765 deletions.
12 changes: 6 additions & 6 deletions Action.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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: |#*@$%&.");
}
Expand Down
4 changes: 2 additions & 2 deletions Affinity.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand All @@ -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++) {
Expand Down
14 changes: 7 additions & 7 deletions AffinityPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion BatteryMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
14 changes: 7 additions & 7 deletions CPUMeter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
Loading

0 comments on commit 61e14d4

Please sign in to comment.