rizinorg / rizin

UNIX-like reverse engineering framework and command-line toolset.
https://rizin.re
GNU Lesser General Public License v3.0
2.71k stars 363 forks source link

Refactor Panels mode (`librz/core/tui/panels.c`) to use API instead of commands #383

Open XVilka opened 3 years ago

XVilka commented 3 years ago

Currently the code of Panels modes heavily relies on running commands instead of just calling the proper API functions. To reduce the overhead, code cruft, and code breakage in case of the command changes it is important to remove all those command calls and call the proper API directly.

$ rg "rz_core_cmd[0f_]*\(" librz/core/tui/panels.c                                                                                                                                                                                 rg "rz_core_cmd[0f_]*\(" librz/core/tui/panels.c
1666:         rz_core_cmd(core, buf, 1);
6937:                 (void)rz_core_cmd0(core, cmd);
6943:                 (void)rz_core_cmd0(core, cmd);
6951:                 (void)rz_core_cmd0(core, cmd);
6957:                 (void)rz_core_cmd0(core, cmd);
6963:                 (void)rz_core_cmd0(core, cmd);
6969:                 (void)rz_core_cmd0(core, cmd);
6975:                 (void)rz_core_cmd0(core, cmd);
6986:                 (void)rz_core_cmd0(core, cmd);
6997:                 (void)rz_core_cmd0(core, cmd);
7008:                 (void)rz_core_cmd0(core, cmd);
7014:                 (void)rz_core_cmd0(core, cmd);
7020:                 (void)rz_core_cmd0(core, cmd);
ret2libc commented 3 years ago

I think this can probably be moved to a later release. It's just refactoring and we seem to have already a lot of things in our hands.