Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ColumnsPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ static void ColumnsPanel_delete(Object* object) {

static void ColumnsPanel_cancelMoving(ColumnsPanel* this) {
Panel* super = &this->super;
for (int i = 0; i < Panel_size(super); i++) {
const int n = Panel_size(super);
for (int i = 0; i < n; i++) {
ListItem* item = (ListItem*) Panel_get(super, i);
if (item)
item->moving = false;
Expand Down
6 changes: 4 additions & 2 deletions MainPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ void MainPanel_updateLabels(MainPanel* this, bool list, bool filter) {
static void MainPanel_idSearch(MainPanel* this, int ch) {
Panel* super = &this->super;
pid_t id = ch - 48 + this->idSearch;
for (int i = 0; i < Panel_size(super); i++) {
const int n = Panel_size(super);
for (int i = 0; i < n; i++) {
const Row* row = (const Row*) Panel_get(super, i);
if (row && row->id == id) {
Panel_setSelected(super, i);
Expand Down Expand Up @@ -181,7 +182,8 @@ bool MainPanel_foreachRow(MainPanel* this, MainPanel_foreachRowFn fn, Arg arg, b
Panel* super = &this->super;
bool ok = true;
bool anyTagged = false;
for (int i = 0; i < Panel_size(super); i++) {
const int n = Panel_size(super);
for (int i = 0; i < n; i++) {
Row* row = (Row*) Panel_get(super, i);
if (row->tag) {
ok &= fn(row, arg);
Expand Down
6 changes: 4 additions & 2 deletions MetersPanel.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ void MetersPanel_setMoving(MetersPanel* this, bool moving) {
this->moving = moving;
if (!moving) {
/* Reset all items' moving flags when canceling move mode */
for (int i = 0; i < Panel_size(super); i++) {
const int n = Panel_size(super);
for (int i = 0; i < n; i++) {
ListItem* item = (ListItem*) Panel_get(super, i);
if (item)
item->moving = false;
Expand Down Expand Up @@ -223,7 +224,8 @@ MetersPanel* MetersPanel_new(Settings* settings, const char* header, Vector* met
this->rightNeighbor = NULL;
this->leftNeighbor = NULL;
Panel_setHeader(super, header);
for (int i = 0; i < Vector_size(meters); i++) {
const int n = Vector_size(meters);
for (int i = 0; i < n; i++) {
const Meter* meter = (const Meter*) Vector_get(meters, i);
Panel_add(super, (Object*) Meter_toListItem(meter, false));
}
Expand Down
Loading