rizinorg / rizin

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

Refactor Visual Menus `/librz/core/tui/vmenus*` to use API instead of commands #491

Open XVilka opened 3 years ago

XVilka commented 3 years ago

Currently the code of Visual menus 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.

[i] ℤ rg "rz_core_cmd[0f_]*\(" librz/core/tui/vmenus*                                                                                                                                                                                    librz/core/tui/vmenus_graph.c
421:                  rz_core_cmd0(core, cmd);

librz/core/tui/vmenus.c
496:                  rz_core_cmdf(core, ".dte %d", i);
498:          rz_core_cmd0(core, "x 64@r:SP");
502:          rz_core_cmdf(core, "dtd %d", delta);
585:  rz_core_cmd0(core, cmd);
850:                  rz_core_cmd0(core, "s $(afl~...)");
885:                          rz_core_cmd0(core, sortModes[sortMode % 4]);
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.