Skip to content

Commit

Permalink
Refactor imports-related stuff from RzList to RzPVector (#3781)
Browse files Browse the repository at this point in the history
+ Switch the member imports in RzBinPlugin from RzList to RzPVector
+ Also switch the member imports in RzBinObject from RzList to RzPVector to meet the refactor of RzBinPlugin
+ Modify the traverse and invocation related to the aforementioned changes
+ Remove the deprecated API rz_bin_get_imports
  • Loading branch information
PeiweiHu authored Aug 24, 2023
1 parent f0c932f commit a5780a3
Show file tree
Hide file tree
Showing 36 changed files with 171 additions and 135 deletions.
6 changes: 0 additions & 6 deletions librz/bin/bin.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,12 +610,6 @@ RZ_DEPRECATE RZ_API RZ_BORROW RzList /*<RzBinField *>*/ *rz_bin_get_fields(RZ_NO
return o ? (RzList *)rz_bin_object_get_fields(o) : NULL;
}

RZ_DEPRECATE RZ_API RZ_BORROW RzList /*<RzBinImport *>*/ *rz_bin_get_imports(RZ_NONNULL RzBin *bin) {
rz_return_val_if_fail(bin, NULL);
RzBinObject *o = rz_bin_cur_object(bin);
return o ? (RzList *)rz_bin_object_get_imports(o) : NULL;
}

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);
Expand Down
4 changes: 3 additions & 1 deletion librz/bin/bin_language.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ RZ_API RzBinLanguage rz_bin_language_detect(RzBinFile *binfile) {
}

if (is_macho || is_elf) {
rz_list_foreach (o->imports, iter, imp) {
void **vec_it;
rz_pvector_foreach (o->imports, vec_it) {
imp = *vec_it;
const char *name = imp->name;
if (!strcmp(name, "_NSConcreteGlobalBlock")) {
is_blocks = true;
Expand Down
4 changes: 2 additions & 2 deletions librz/bin/bobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ RZ_IPI void rz_bin_object_free(RzBinObject *o) {
rz_list_free(o->classes);
rz_list_free(o->entries);
rz_list_free(o->fields);
rz_list_free(o->imports);
rz_pvector_free(o->imports);
rz_list_free(o->libs);
rz_list_free(o->maps);
rz_list_free(o->mem);
Expand Down Expand Up @@ -665,7 +665,7 @@ RZ_API const RzList /*<RzBinField *>*/ *rz_bin_object_get_fields(RZ_NONNULL RzBi
/**
* \brief Get list of \p RzBinImport representing the imports of the binary object.
*/
RZ_API const RzList /*<RzBinImport *>*/ *rz_bin_object_get_imports(RZ_NONNULL RzBinObject *obj) {
RZ_API const RzPVector /*<RzBinImport *>*/ *rz_bin_object_get_imports(RZ_NONNULL RzBinObject *obj) {
rz_return_val_if_fail(obj, NULL);
return obj->imports;
}
Expand Down
17 changes: 9 additions & 8 deletions librz/bin/bobj_process_import.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,23 @@ RZ_IPI RzBinProcessLanguage rz_bin_process_language_import(RzBinObject *o) {
RZ_IPI void rz_bin_set_imports_from_plugin(RzBinFile *bf, RzBinObject *o) {
RzBinPlugin *plugin = o->plugin;

rz_list_free(o->imports);
rz_pvector_free(o->imports);
if (!plugin->imports || !(o->imports = plugin->imports(bf))) {
o->imports = rz_list_newf((RzListFree)rz_bin_import_free);
o->imports = rz_pvector_new((RzPVectorFree)rz_bin_import_free);
}
rz_warn_if_fail(o->imports->free);
}

RZ_IPI void rz_bin_process_imports(RzBinFile *bf, RzBinObject *o, const RzDemanglerPlugin *demangler, RzDemanglerFlag flags) {
if (!demangler || rz_list_length(o->imports) < 1) {
if (!demangler || rz_pvector_len(o->imports) < 1) {
return;
}

RzBinProcessLanguage language_cb = rz_bin_process_language_import(o);

RzListIter *it;
void **it;
RzBinImport *element;
rz_list_foreach (o->imports, it, element) {
rz_pvector_foreach (o->imports, it) {
element = *it;
if (!element->name) {
continue;
}
Expand All @@ -67,9 +67,10 @@ RZ_IPI void rz_bin_process_imports(RzBinFile *bf, RzBinObject *o, const RzDemang
}

RZ_IPI void rz_bin_demangle_imports_with_flags(RzBinObject *o, const RzDemanglerPlugin *demangler, RzDemanglerFlag flags) {
RzListIter *it;
void **it;
RzBinImport *element;
rz_list_foreach (o->imports, it, element) {
rz_pvector_foreach (o->imports, it) {
element = *it;
if (!element->name) {
continue;
}
Expand Down
14 changes: 7 additions & 7 deletions librz/bin/format/dex/dex.c
Original file line number Diff line number Diff line change
Expand Up @@ -1392,21 +1392,21 @@ RZ_API RZ_OWN RzList /*<RzBinSymbol *>*/ *rz_bin_dex_symbols(RZ_NONNULL RzBinDex
}

/**
* \brief Returns a RzList<RzBinImport*> containing the dex imports
* \brief Returns a RzPVector<RzBinImport*> containing the dex imports
*/
RZ_API RZ_OWN RzList /*<RzBinImport *>*/ *rz_bin_dex_imports(RZ_NONNULL RzBinDex *dex) {
RZ_API RZ_OWN RzPVector /*<RzBinImport *>*/ *rz_bin_dex_imports(RZ_NONNULL RzBinDex *dex) {
rz_return_val_if_fail(dex, NULL);

DexFieldId *field_id;
DexMethodId *method_id;
DexClassDef *class_def;
RzList *imports = NULL;
RzPVector *imports = NULL;
ut32 *class_ids = NULL;
void **vit;

ut32 n_classes = rz_pvector_len(dex->class_defs);
if (n_classes < 1) {
return rz_list_newf((RzListFree)rz_bin_import_free);
return rz_pvector_new((RzPVectorFree)rz_bin_import_free);
}

class_ids = RZ_NEWS0(ut32, n_classes);
Expand All @@ -1421,7 +1421,7 @@ RZ_API RZ_OWN RzList /*<RzBinImport *>*/ *rz_bin_dex_imports(RZ_NONNULL RzBinDex
j++;
}

imports = rz_list_newf((RzListFree)rz_bin_import_free);
imports = rz_pvector_new((RzPVectorFree)rz_bin_import_free);
if (!imports) {
free(class_ids);
return NULL;
Expand Down Expand Up @@ -1453,7 +1453,7 @@ RZ_API RZ_OWN RzList /*<RzBinImport *>*/ *rz_bin_dex_imports(RZ_NONNULL RzBinDex
import->type = RZ_BIN_TYPE_FIELD_STR;
import->ordinal = ordinal;

if (!rz_list_append(imports, import)) {
if (!rz_pvector_push(imports, import)) {
rz_bin_import_free(import);
break;
}
Expand Down Expand Up @@ -1487,7 +1487,7 @@ RZ_API RZ_OWN RzList /*<RzBinImport *>*/ *rz_bin_dex_imports(RZ_NONNULL RzBinDex
import->ordinal = ordinal;
free(name);

if (!rz_list_append(imports, import)) {
if (!rz_pvector_push(imports, import)) {
rz_bin_import_free(import);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion librz/bin/format/dex/dex.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ RZ_API RZ_OWN RzList /*<RzBinClass *>*/ *rz_bin_dex_classes(RZ_NONNULL RzBinDex
RZ_API RZ_OWN RzList /*<RzBinClassField *>*/ *rz_bin_dex_fields(RZ_NONNULL RzBinDex *dex);
RZ_API RZ_OWN RzList /*<RzBinSection *>*/ *rz_bin_dex_sections(RZ_NONNULL RzBinDex *dex);
RZ_API RZ_OWN RzList /*<RzBinSymbol *>*/ *rz_bin_dex_symbols(RZ_NONNULL RzBinDex *dex);
RZ_API RZ_OWN RzList /*<RzBinImport *>*/ *rz_bin_dex_imports(RZ_NONNULL RzBinDex *dex);
RZ_API RZ_OWN RzPVector /*<RzBinImport *>*/ *rz_bin_dex_imports(RZ_NONNULL RzBinDex *dex);
RZ_API RZ_OWN RzList /*<char *>*/ *rz_bin_dex_libraries(RZ_NONNULL RzBinDex *dex);
RZ_API RZ_OWN RzBinAddr *rz_bin_dex_resolve_symbol(RZ_NONNULL RzBinDex *dex, RzBinSpecialSymbol resolve);
RZ_API RZ_OWN RzList /*<RzBinAddr *>*/ *rz_bin_dex_entrypoints(RZ_NONNULL RzBinDex *dex);
Expand Down
12 changes: 6 additions & 6 deletions librz/bin/format/java/class_bin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1551,12 +1551,12 @@ RZ_API RZ_OWN RzList /*<RzBinSymbol *>*/ *rz_bin_java_class_const_pool_as_symbol
}

/**
* \brief Returns a RzList<RzBinImport*> containing the class const pool
* \brief Returns a RzPVector<RzBinImport*> containing the class const pool
*/
RZ_API RZ_OWN RzList /*<RzBinImport *>*/ *rz_bin_java_class_const_pool_as_imports(RZ_NONNULL RzBinJavaClass *bin) {
RZ_API RZ_OWN RzPVector /*<RzBinImport *>*/ *rz_bin_java_class_const_pool_as_imports(RZ_NONNULL RzBinJavaClass *bin) {
rz_return_val_if_fail(bin, NULL);

RzList *imports = rz_list_newf((RzListFree)rz_bin_import_free);
RzPVector *imports = rz_pvector_new((RzListFree)rz_bin_import_free);
if (!imports) {
return NULL;
}
Expand Down Expand Up @@ -1604,7 +1604,7 @@ RZ_API RZ_OWN RzList /*<RzBinImport *>*/ *rz_bin_java_class_const_pool_as_import
import->type = is_main ? RZ_BIN_TYPE_FUNC_STR : import_type(cpool);
import->descriptor = java_class_constant_pool_stringify_at(bin, descriptor_index);
import->ordinal = i;
rz_list_append(imports, import);
rz_pvector_push(imports, import);
free(object);
}
}
Expand Down Expand Up @@ -1638,7 +1638,7 @@ RZ_API RZ_OWN RzList /*<RzBinImport *>*/ *rz_bin_java_class_const_pool_as_import
import->bind = RZ_BIN_BIND_WEAK_STR;
import->type = RZ_BIN_TYPE_IFACE_STR;
import->ordinal = i;
rz_list_append(imports, import);
rz_pvector_push(imports, import);
free(object);
}
}
Expand Down Expand Up @@ -2033,4 +2033,4 @@ RZ_API RZ_OWN RzList /*<RzBinClass *>*/ *rz_bin_java_class_as_classes(RZ_NONNULL
}

return list;
}
}
2 changes: 1 addition & 1 deletion librz/bin/format/java/class_bin.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ RZ_API RZ_OWN RzList /*<RzBinClassField *>*/ *rz_bin_java_class_fields_as_binfie
RZ_API void rz_bin_java_class_fields_as_text(RZ_NONNULL RzBinJavaClass *bin, RZ_NONNULL RzStrBuf *sb);
RZ_API void rz_bin_java_class_fields_as_json(RZ_NONNULL RzBinJavaClass *bin, RZ_NONNULL PJ *j);
RZ_API RZ_OWN RzList /*<RzBinSymbol *>*/ *rz_bin_java_class_const_pool_as_symbols(RZ_NONNULL RzBinJavaClass *bin);
RZ_API RZ_OWN RzList /*<RzBinImport *>*/ *rz_bin_java_class_const_pool_as_imports(RZ_NONNULL RzBinJavaClass *bin);
RZ_API RZ_OWN RzPVector /*<RzBinImport *>*/ *rz_bin_java_class_const_pool_as_imports(RZ_NONNULL RzBinJavaClass *bin);
RZ_API void rz_bin_java_class_const_pool_as_text(RZ_NONNULL RzBinJavaClass *bin, RZ_NONNULL RzStrBuf *sb);
RZ_API void rz_bin_java_class_const_pool_as_json(RZ_NONNULL RzBinJavaClass *bin, RZ_NONNULL PJ *j);
RZ_API RZ_OWN RzList /*<RzBinSection *>*/ *rz_bin_java_class_as_sections(RZ_NONNULL RzBinJavaClass *bin);
Expand Down
14 changes: 7 additions & 7 deletions librz/bin/format/le/le.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ static RZ_BORROW RzBinImport *le_add_bin_import(rz_bin_le_obj_t *bin, const LE_i
}
import->bind = RZ_BIN_BIND_GLOBAL_STR;
import->type = RZ_BIN_TYPE_UNKNOWN_STR;
CHECK(rz_list_append(bin->imports, import));
CHECK(rz_pvector_push(bin->imports, import));
import->ordinal = ++bin->reloc_targets_count;
return import;
}
Expand Down Expand Up @@ -1508,7 +1508,7 @@ static void rz_bin_le_free(rz_bin_le_obj_t *bin) {
rz_pvector_free(bin->imp_mod_names);
rz_list_free(bin->symbols);
rz_vector_free(bin->le_entries);
rz_list_free(bin->imports);
rz_pvector_free(bin->imports);
ht_pp_free(bin->le_import_ht);
rz_list_free(bin->le_relocs);
free(bin);
Expand Down Expand Up @@ -1552,7 +1552,7 @@ bool rz_bin_le_load_buffer(RzBinFile *bf, RzBinObject *obj, RzBuffer *buf, Sdb *
err_ctx = ", unable to build maps.";
CHECK(bin->le_maps = le_create_maps(bin));
err_ctx = ", unable to load imports.";
CHECK(bin->imports = rz_list_newf((RzListFree)rz_bin_import_free));
CHECK(bin->imports = rz_pvector_new((RzListFree)rz_bin_import_free));
CHECK(bin->symbols = rz_list_newf((RzListFree)rz_bin_symbol_free));
CHECK(bin->imp_mod_names = le_load_import_mod_names(bin));
CHECK(bin->le_entries = le_load_entries(bin));
Expand All @@ -1570,13 +1570,13 @@ bool rz_bin_le_check_buffer(RzBuffer *b) {

static void no_free(void *unused) {}

RZ_OWN RzList /*<RzBinImport *>*/ *rz_bin_le_get_imports(RzBinFile *bf) {
RZ_OWN RzPVector /*<RzBinImport *>*/ *rz_bin_le_get_imports(RzBinFile *bf) {
rz_bin_le_obj_t *bin = bf->o->bin_obj;
if (rz_list_empty(bin->imports)) {
if (rz_pvector_empty(bin->imports)) {
return NULL;
}
RzList *l = rz_list_clone(bin->imports);
l->free = no_free; // silence assertion, there's no need to delete imports
RzPVector *l = rz_pvector_clone(bin->imports);
l->v.free_user = no_free; // silence assertion, there's no need to delete imports
return l;
}

Expand Down
4 changes: 2 additions & 2 deletions librz/bin/format/le/le.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ typedef struct rz_bin_le_obj_s {
RzPVector /*<char *>*/ *imp_mod_names;
RzList /*<RzBinSymbol *>*/ *symbols;
RzVector /*<LE_entry>*/ *le_entries;
RzList /*<RzBinImport *>*/ *imports;
RzPVector /*<RzBinImport *>*/ *imports;
HtPP /*<LE_import *, NULL>*/ *le_import_ht;
RzList /*<LE_reloc *>*/ *le_relocs;
ut32 reloc_target_map_base;
Expand All @@ -107,7 +107,7 @@ RZ_OWN RzList /*<RzBinMap *>*/ *rz_bin_le_get_maps(RzBinFile *bf);
RZ_OWN RzList /*<RzBinAddr *>*/ *rz_bin_le_get_entry_points(RzBinFile *bf);
RZ_OWN RzList /*<RzBinSection *>*/ *rz_bin_le_get_sections(RzBinFile *bf);
RZ_OWN RzList /*<RzBinSymbol *>*/ *rz_bin_le_get_symbols(RzBinFile *bf);
RZ_OWN RzList /*<RzBinImport *>*/ *rz_bin_le_get_imports(RzBinFile *bf);
RZ_OWN RzPVector /*<RzBinImport *>*/ *rz_bin_le_get_imports(RzBinFile *bf);
RZ_OWN RzList /*<char *>*/ *rz_bin_le_get_libs(RzBinFile *bf);
RZ_OWN RzList /*<RzBinReloc *>*/ *rz_bin_le_get_relocs(RzBinFile *bf);
RZ_OWN RzList /*<RzBinVirtualFile *>*/ *rz_bin_le_get_virtual_files(RzBinFile *bf);
Expand Down
9 changes: 5 additions & 4 deletions librz/bin/format/mdmp/mdmp_pe.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,17 @@ static void filter_import(ut8 *n) {
}
}

RzList /*<RzBinImport *>*/ *PE_(rz_bin_mdmp_pe_get_imports)(struct PE_(rz_bin_mdmp_pe_bin) * pe_bin) {
RzPVector /*<RzBinImport *>*/ *PE_(rz_bin_mdmp_pe_get_imports)(struct PE_(rz_bin_mdmp_pe_bin) * pe_bin) {
int i;
ut64 offset;
struct rz_bin_pe_import_t *imports = NULL;
RzBinImport *ptr = NULL;
RzBinReloc *rel;
RzList *ret, *relocs;
RzPVector *ret;
RzList *relocs;

imports = PE_(rz_bin_pe_get_imports)(pe_bin->bin);
ret = rz_list_new();
ret = rz_pvector_new(NULL);
relocs = rz_list_newf(free);

if (!imports || !ret || !relocs) {
Expand All @@ -117,7 +118,7 @@ RzList /*<RzBinImport *>*/ *PE_(rz_bin_mdmp_pe_get_imports)(struct PE_(rz_bin_md
ptr->bind = "NONE";
ptr->type = RZ_BIN_TYPE_FUNC_STR;
ptr->ordinal = imports[i].ordinal;
rz_list_append(ret, ptr);
rz_pvector_push(ret, ptr);

if (!(rel = RZ_NEW0(RzBinReloc))) {
break;
Expand Down
2 changes: 1 addition & 1 deletion librz/bin/format/mdmp/mdmp_pe.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct PE_(rz_bin_mdmp_pe_bin) {
};

RzList /*<RzBinAddr *>*/ *PE_(rz_bin_mdmp_pe_get_entrypoint)(struct PE_(rz_bin_mdmp_pe_bin) * pe_bin);
RzList /*<RzBinImport *>*/ *PE_(rz_bin_mdmp_pe_get_imports)(struct PE_(rz_bin_mdmp_pe_bin) * pe_bin);
RzPVector /*<RzBinImport *>*/ *PE_(rz_bin_mdmp_pe_get_imports)(struct PE_(rz_bin_mdmp_pe_bin) * pe_bin);
RzList /*<RzBinSection *>*/ *PE_(rz_bin_mdmp_pe_get_sections)(struct PE_(rz_bin_mdmp_pe_bin) * pe_bin);
RzList /*<RzBinSymbol *>*/ *PE_(rz_bin_mdmp_pe_get_symbols)(RzBin *rbin, struct PE_(rz_bin_mdmp_pe_bin) * pe_bin);

Expand Down
6 changes: 3 additions & 3 deletions librz/bin/format/ne/ne.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ static bool __ne_get_resources(rz_bin_ne_obj_t *bin) {
return true;
}

RzList /*<RzBinImport *>*/ *rz_bin_ne_get_imports(rz_bin_ne_obj_t *bin) {
RzList *imports = rz_list_newf((RzListFree)rz_bin_import_free);
RzPVector /*<RzBinImport *>*/ *rz_bin_ne_get_imports(rz_bin_ne_obj_t *bin) {
RzPVector *imports = rz_pvector_new((RzListFree)rz_bin_import_free);
if (!imports) {
return NULL;
}
Expand Down Expand Up @@ -383,7 +383,7 @@ RzList /*<RzBinImport *>*/ *rz_bin_ne_get_imports(rz_bin_ne_obj_t *bin) {
name[sz] = '\0';
imp->name = name;
imp->ordinal = i + 1;
rz_list_append(imports, imp);
rz_pvector_push(imports, imp);
off += sz;
}
bin->imports = imports;
Expand Down
4 changes: 2 additions & 2 deletions librz/bin/format/ne/ne.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ typedef struct {
RzList /*<RzBinSection *>*/ *segments;
RzList /*<RzBinAddr *>*/ *entries;
RzList /*<rz_ne_resource *>*/ *resources;
RzList /*<RzBinImport *>*/ *imports;
RzPVector /*<RzBinImport *>*/ *imports;
RzList /*<RzBinSymbol *>*/ *symbols;
char *os;
} rz_bin_ne_obj_t;

void rz_bin_ne_free(rz_bin_ne_obj_t *bin);
rz_bin_ne_obj_t *rz_bin_ne_new_buf(RzBuffer *buf, bool verbose);
RzList /*<RzBinReloc *>*/ *rz_bin_ne_get_relocs(rz_bin_ne_obj_t *bin);
RzList /*<RzBinImport *>*/ *rz_bin_ne_get_imports(rz_bin_ne_obj_t *bin);
RzPVector /*<RzBinImport *>*/ *rz_bin_ne_get_imports(rz_bin_ne_obj_t *bin);
RzList /*<RzBinSymbol *>*/ *rz_bin_ne_get_symbols(rz_bin_ne_obj_t *bin);
RzList /*<RzBinSection *>*/ *rz_bin_ne_get_segments(rz_bin_ne_obj_t *bin);
RzList /*<RzBinAddr *>*/ *rz_bin_ne_get_entrypoints(rz_bin_ne_obj_t *bin);
Expand Down
4 changes: 2 additions & 2 deletions librz/bin/format/nxo/nxo.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ static void walkSymbols(RzBuffer *buf, RzBinNXOObj *bin, ut64 symtab, ut64 strta
if (!imp->bind) {
goto out_walk_symbol;
}
imp->ordinal = bin->imports_list->length;
rz_list_append(bin->imports_list, imp);
imp->ordinal = bin->imports_vec->v.len;
rz_pvector_push(bin->imports_vec, imp);
sym->is_imported = true;
sym->name = strdup(symName);
if (!sym->name) {
Expand Down
2 changes: 1 addition & 1 deletion librz/bin/format/nxo/nxo.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ typedef struct {
typedef struct {
ut32 *strings;
RzList /*<RzBinSymbol *>*/ *methods_list;
RzList /*<RzBinImport *>*/ *imports_list;
RzPVector /*<RzBinImport *>*/ *imports_vec;
RZ_NULLABLE RzBuffer *decompressed; /// nso-only
void *header;
} RzBinNXOObj;
Expand Down
6 changes: 3 additions & 3 deletions librz/bin/p/bin_coff.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,10 @@ static RzList /*<RzBinSymbol *>*/ *symbols(RzBinFile *bf) {
return ret;
}

static RzList /*<RzBinImport *>*/ *imports(RzBinFile *bf) {
static RzPVector /*<RzBinImport *>*/ *imports(RzBinFile *bf) {
int i;
struct rz_bin_coff_obj *obj = (struct rz_bin_coff_obj *)bf->o->bin_obj;
RzList *ret = rz_list_newf((RzListFree)rz_bin_import_free);
RzPVector *ret = rz_pvector_new((RzListFree)rz_bin_import_free);
if (!ret) {
return NULL;
}
Expand All @@ -367,7 +367,7 @@ static RzList /*<RzBinImport *>*/ *imports(RzBinFile *bf) {
for (i = 0; i < obj->hdr.f_nsyms; i++) {
RzBinImport *ptr = ht_up_find(obj->imp_ht, i, NULL);
if (ptr) {
rz_list_append(ret, ptr);
rz_pvector_push(ret, ptr);
}
i += obj->symbols[i].n_numaux;
}
Expand Down
2 changes: 1 addition & 1 deletion librz/bin/p/bin_dex.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static RzList /*<RzBinClass *>*/ *classes(RzBinFile *bf) {
return rz_bin_dex_classes(dex);
}

static RzList /*<RzBinImport *>*/ *imports(RzBinFile *bf) {
static RzPVector /*<RzBinImport *>*/ *imports(RzBinFile *bf) {
RzBinDex *dex = rz_bin_file_get_dex(bf);
if (!dex) {
return NULL;
Expand Down
Loading

0 comments on commit a5780a3

Please sign in to comment.