Skip to content
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

Convert rz-bin cmd call in rz-find to API #2441

Merged
merged 4 commits into from
Mar 24, 2022
Merged

Conversation

chinggg
Copy link
Contributor

@chinggg chinggg commented Mar 23, 2022

Your checklist for this pull request

  • I've read the guidelines for contributing to this repository
  • I made sure to follow the project's coding style
  • I've documented or updated the documentation of every function and struct this PR changes. If not so I've explained why.
  • I've added tests that prove my fix is effective or that my feature works (if possible)
  • I've updated the rizin book with the relevant information (if needed)

Detailed description

Test plan

...

Closing issues

closes #1475
...

Copy link
Member

@ret2libc ret2libc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is state used here? Also, is it really necessary to have core?

@chinggg
Copy link
Contributor Author

chinggg commented Mar 24, 2022

How is state used here? Also, is it really necessary to have core?

You are right, state is not used since the output mode is specified by bf->strmode.

If RzCore is not used, more code is needed to make RzBin work, which do you prefer?

RzBin *bin = rz_bin_new();
RzIO *rio = rz_io_new();
rio->cb_printf = rz_cons_printf;
rz_io_bind(rio, &bin->iob);
// ..
rz_bin_free(bin);
rz_io_free(rio);

@wargio
Copy link
Member

wargio commented Mar 24, 2022

you can just printf without rz_cons

Copy link
Member

@ret2libc ret2libc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Damn, rz_bin_dump_strings API is really bad...

@chinggg
Copy link
Contributor Author

chinggg commented Mar 24, 2022

Yes. In fact I think sometimes it is more convenient to use command especially if the API is not well-designed.
For the other usage of rz_sys_cmdf in the same function rzfind_open_file, should it be replaced by internal API?

@wargio
Copy link
Member

wargio commented Mar 24, 2022

Thanks!

Damn, rz_bin_dump_strings API is really bad...

i will remove it in one of my PRs on RzPrint

@wargio wargio merged commit bada425 into rizinorg:dev Mar 24, 2022
@chinggg chinggg deleted the rz-find-cmd2API branch March 28, 2022 12:18
DavidAfonsoValente pushed a commit to DavidAfonsoValente/rizin that referenced this pull request May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert i/rz-bin calls inside Rizin to the API calls
4 participants