-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
Refactor output modes to use enum #489
Comments
Please note that there is RzOutputMode that is used in newshell commands. |
Hi. I am currently working on this issue as a microtask for gsoc this year. I was going through the code and there are several questions that I would like to ask.
|
See the example of |
@XVilka Thanks for the clarifications! I'll start working on this immediately. |
There are a few more modes that I have come across. Could you please let me know what they are? They are 'c', 'x' and 'w' in this switch case and 'm' in this statement |
There are some common modes, that are explained in RzOutputMode. Other commands might have various suffixes, but they are not generic enough to use them everywhere. So for those cases we won't use just RzOutputMode. |
In that case, should I leave the ones that aren't described in |
Yes |
In some functions (for example in this one), Also, should |
@valdaarhun |
I tried rebuilding and recompiling the project after making the changes and got a compilation error. In this switch case, there's Should I leave |
when you convert the command you have to add a small fix to the old shell. essentially instead of passing to mode a char you will have to pass |
@wargio I have understood what you mean. So basically, for example, in functions that have But there are some functions in which it checks the value of mode(for example |
you can still change that from |
You also need to change |
Hi. I have almost completed refactoring the code base. There were just a few more questions that I wanted to ask.
|
can you please open a PR (draft mode) so we can inspect the code? it's hard to understand what you are talking about! |
@wargio Yeah, I'll do that. |
Currently you can often see in the code the following pattern:
In some cases it looks like that:
Sometimes there is no "mode" word, and it looks like that:
I recommend to search for
int mode
andchar mode
patterns in the code.It prevents catching some errors at the compilation time and reduces the readability.
Should be refactored to use enum instead, across the whole Rizin code.
After everything ported, the following hardcoded values should be removed from
librz/include/rz_types.h
:See, for example:
The text was updated successfully, but these errors were encountered: