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

Remove the deprecated API rz_bin_get_info #4119

Merged
merged 1 commit into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions librz/bin/bin.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,12 +598,6 @@ RZ_API void rz_bin_set_baddr(RzBin *bin, ut64 baddr) {
}
}

RZ_DEPRECATE RZ_API RZ_BORROW RzBinInfo *rz_bin_get_info(RzBin *bin) {
rz_return_val_if_fail(bin, NULL);
RzBinObject *o = rz_bin_cur_object(bin);
return o ? (RzBinInfo *)rz_bin_object_get_info(o) : NULL;
}

/**
* \brief Find the binary section at offset \p off.
*
Expand Down
3 changes: 2 additions & 1 deletion librz/bin/pdb/pdb_downloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ static bool is_valid_guid(const char *guid) {
RZ_API int rz_bin_pdb_download(RZ_NONNULL RzBin *bin, RZ_NULLABLE PJ *pj, int isradjson, RZ_NONNULL SPDBOptions *options) {
rz_return_val_if_fail(bin && options, 1);
SPDBDownloaderOpt opt;
RzBinInfo *info = rz_bin_get_info(bin);
RzBinObject *obj = rz_bin_cur_object(bin);
RzBinInfo *info = obj ? (RzBinInfo *)rz_bin_object_get_info(obj) : NULL;

if (!info || !info->debug_file_name) {
RZ_LOG_ERROR("Can't find debug filename\n");
Expand Down
15 changes: 10 additions & 5 deletions librz/core/cbin.c
Original file line number Diff line number Diff line change
Expand Up @@ -2971,7 +2971,8 @@ RZ_API bool rz_core_file_info_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFil
rz_return_val_if_fail(core && core->file && state, false);

bool io_cache = rz_config_get_i(core->config, "io.cache");
RzBinInfo *info = rz_bin_get_info(core->bin);
RzBinObject *obj = rz_bin_cur_object(core->bin);
RzBinInfo *info = obj ? (RzBinInfo *)rz_bin_object_get_info(obj) : NULL;
int fd = rz_io_fd_get_current(core->io);
RzIODesc *desc = rz_io_desc_get(core->io, fd);
RzBinPlugin *plugin = rz_bin_file_cur_plugin(binfile);
Expand Down Expand Up @@ -3071,7 +3072,8 @@ static const char *str2na(const char *s) {
RZ_API bool rz_core_bin_info_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state) {
rz_return_val_if_fail(core && state, false);

RzBinInfo *info = rz_bin_get_info(core->bin);
RzBinObject *o = rz_bin_cur_object(core->bin);
RzBinInfo *info = o ? (RzBinInfo *)rz_bin_object_get_info(o) : NULL;
RzBinPlugin *plugin = rz_bin_file_cur_plugin(bf);
ut64 laddr = rz_bin_get_laddr(core->bin);
if (!bf) {
Expand Down Expand Up @@ -4494,7 +4496,8 @@ static void bin_mach0_versioninfo(RzCore *r, PJ *pj, int mode) {
}

static int bin_versioninfo(RzCore *r, PJ *pj, int mode) {
const RzBinInfo *info = rz_bin_get_info(r->bin);
RzBinObject *obj = rz_bin_cur_object(r->bin);
const RzBinInfo *info = obj ? rz_bin_object_get_info(obj) : NULL;
if (!info || !info->rclass) {
return false;
}
Expand Down Expand Up @@ -4604,7 +4607,8 @@ static void core_bin_file_print(RzCore *core, RzBinFile *bf, RzCmdStateOutput *s
rz_return_if_fail(core && bf && bf->o);

const char *name = bf ? bf->file : NULL;
(void)rz_bin_get_info(core->bin); // XXX is this necssary for proper iniitialization
RzBinObject *o = rz_bin_cur_object(core->bin);
(void)rz_bin_object_get_info(o); // XXX is this necssary for proper iniitialization
ut32 bin_sz = bf ? bf->size : 0;
RzBinObject *obj = bf->o;
RzBinInfo *info = obj->info;
Expand Down Expand Up @@ -4937,7 +4941,8 @@ RZ_API bool rz_core_bin_dwarf_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFil
}

RZ_API RZ_OWN char *rz_core_bin_pdb_get_filename(RZ_NONNULL RzCore *core) {
RzBinInfo *info = rz_bin_get_info(core->bin);
RzBinObject *obj = rz_bin_cur_object(core->bin);
RzBinInfo *info = obj ? (RzBinInfo *)rz_bin_object_get_info(obj) : NULL;
/* Autodetect local file */
if (!info || !info->debug_file_name) {
return NULL;
Expand Down
3 changes: 2 additions & 1 deletion librz/core/cesil.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ static ut64 initializeEsil(RzCore *core) {
RzBinInfo *info = NULL;
if (entries && !rz_pvector_empty(entries)) {
entry = (RzBinAddr *)rz_pvector_pop_front(entries);
info = rz_bin_get_info(core->bin);
RzBinObject *obj = rz_bin_cur_object(core->bin);
info = obj ? (RzBinInfo *)rz_bin_object_get_info(obj) : NULL;
addr = info->has_va ? entry->vaddr : entry->paddr;
rz_pvector_push(entries, entry);
} else {
Expand Down
3 changes: 2 additions & 1 deletion librz/core/cmd/cmd_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,8 @@ RZ_IPI RzCmdStatus rz_cmd_info_resources_handler(RzCore *core, int argc, const c

RZ_IPI RzCmdStatus rz_cmd_info_hashes_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) {
ut64 limit = rz_config_get_i(core->config, "bin.hashlimit");
RzBinInfo *info = rz_bin_get_info(core->bin);
RzBinObject *obj = rz_bin_cur_object(core->bin);
RzBinInfo *info = obj ? (RzBinInfo *)rz_bin_object_get_info(obj) : NULL;
if (!info) {
RZ_LOG_ERROR("core: Cannot get bin info\n");
return RZ_CMD_STATUS_ERROR;
Expand Down
3 changes: 2 additions & 1 deletion librz/core/linux_heap_glibc.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ static GHT GH(get_main_arena_with_symbol)(RzCore *core, RzDebugMap *map) {
main_arena = base_addr + off;
goto beach;
}
RzBinInfo *info = rz_bin_get_info(core->bin);
RzBinObject *o = rz_bin_cur_object(core->bin);
RzBinInfo *info = o ? (RzBinInfo *)rz_bin_object_get_info(o) : NULL;
if (!strcmp(info->arch, "x86") && info->bits == 64 &&
// Assumes that the vaddr of LOAD0 is 0x0
(off = GH(get_va_symbol)(core, path, "mallopt")) != GHT_MAX) {
Expand Down
3 changes: 2 additions & 1 deletion librz/core/windows_heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ static bool GetHeapGlobalsOffset(RzDebug *dbg, HANDLE h_proc) {
}
char *pdb_path = NULL;
RzPdb *pdb = NULL;
RzBinInfo *info = rz_bin_get_info(core->bin);
RzBinObject *o = rz_bin_cur_object(core->bin);
RzBinInfo *info = o ? (RzBinInfo *)rz_bin_object_get_info(o) : NULL;
if (!info) {
goto fail;
}
Expand Down
1 change: 0 additions & 1 deletion librz/include/rz_bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,6 @@ RZ_API void rz_bin_force_plugin(RzBin *bin, const char *pname);
RZ_API ut64 rz_bin_get_baddr(RzBin *bin);
RZ_API ut64 rz_bin_file_get_baddr(RzBinFile *bf);
RZ_API void rz_bin_set_user_ptr(RzBin *bin, void *user);
RZ_DEPRECATE RZ_API RZ_BORROW RzBinInfo *rz_bin_get_info(RzBin *bin);
RZ_API void rz_bin_set_baddr(RzBin *bin, ut64 baddr);
RZ_API ut64 rz_bin_get_laddr(RzBin *bin);
RZ_API ut64 rz_bin_get_size(RzBin *bin);
Expand Down
Loading