-
-
Notifications
You must be signed in to change notification settings - Fork 529
Implement process state filter (#1544/#1755) #1757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
No problem, do you want me to fix the indentation? |
2019e60 to
4cf9bd6
Compare
|
@melrovieira: Não precisa; já corrigi o recuo e limpei tudo. Por favor, dê uma olhada nos commits atualizados neste PR. Tomei a liberdade de limpá-los para conter apenas alterações em locais do código onde a alteração era realmente necessária. Em PRs futuros, certifique-se de usar @melrovieira: No need; I already fixed the indentation and cleaned things up. Please take a look at the updated commits in this PR. I took the liberty to clean them up to only contain changes to code locations where a change was actually necessary. In future PRs be sure to use |
Okay, I'll remember that. Thank you very much. 🤝 |
a0794f3 to
2dfd1d1
Compare
…esses by state. This exposes the internal Process state character conversion function so it can be reused for the filter string processing. Multiple characters are allowed for the filter and a process is displayed if any of the provided state characters matches the state of the process currently processed. Co-authored-by: Allison <[email protected]> Co-authored-by: BenBE <[email protected]>
This creates a small lookup table to speed up the check (O(n+m) instead of O(n*m)).
2dfd1d1 to
f0002ff
Compare
| } | ||
| bool valid_arg = true; | ||
| for (char* c = optarg; *c != '\0' && valid_arg; c++) { | ||
| if (*c == ',' || isspace(*c)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be just me, but I prefer isblank rather than isspace here.
| fprintf(stderr, "Error: invalid state filter value \"%s\".\n", optarg); | ||
| return STATUS_ERROR_EXIT; | ||
| } | ||
| valid_arg &= valid_states[(int)*c]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since valid_arg is a boolean, using a bitwise AND operator doesn't look like a good idea to me.
| valid_arg &= valid_states[(int)*c]; | |
| if (!valid_states[(int)*c]) { | |
| valid_arg = false; | |
| break; | |
| } |
This PR is a continuation of #1755, due to an accidentally fumbled push operation.
@melrovieira: Sorry, the git push to edit your PR (to clean up the commits), accidentally pushed the wrong commit to Github and thus unintentionally closed the PR.
This PR restores the actually intended push.