Skip to content

Affinity/AvailableMeters panels: move const calc expression out of loop#2039

Open
GermanAizek wants to merge 1 commit into
htop-dev:mainfrom
GermanAizek:const-out-of-loop1
Open

Affinity/AvailableMeters panels: move const calc expression out of loop#2039
GermanAizek wants to merge 1 commit into
htop-dev:mainfrom
GermanAizek:const-out-of-loop1

Conversation

@GermanAizek

Copy link
Copy Markdown
Contributor

Reference: #2038

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9bc8947f-a6e7-45ef-8745-d7b33a2f82a9

📥 Commits

Reviewing files that changed from the base of the PR and between 1ef4226 and b3c4854.

📒 Files selected for processing (2)
  • AffinityPanel.c
  • AvailableMetersPanel.c

📝 Walkthrough

Walkthrough

Changes

Refactors loop constructs in AffinityPanel.c and AvailableMetersPanel.c to cache repeatedly-accessed vector sizes and struct field values (e.g., Vector_size(...), host->existingCPUs, affinity->used) into local const variables before use in loop bounds and conditionals. Also fixes a non-const intermediate cast in AffinityPanel_getAffinity to cast directly to const AffinityPanel*. No exported/public declarations changed.

Sequence Diagram(s)

Not applicable — changes are local variable caching and a cast fix with no altered control/data flow between components.

Related PRs: None specified.

Suggested labels: refactor, code-quality

Suggested reviewers: None specified.

Poem

A rabbit hops through loops so tight,
Caching sizes, saving bytes,
No more re-asking "how big are you?"
Just once, then loop the whole way through.
Const casts fixed, the code shines clean —
Tidiest burrow this bunny's seen. 🐇


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant