RZ_API RZ_OWN RzList /*<RzBinField *>*/ *rz_bin_dex_fields(RZ_NONNULL RzBinDex *dex) {
	rz_return_val_if_fail(dex, NULL);

	DexClassDef *class_def;
	RzList *fields = NULL;
	void **it;
	ut32 n_fields = rz_pvector_len(dex->field_ids);
	ut8 *inserted = RZ_NEWS0(ut8, n_fields);
	if (n_fields > 0 && !inserted) {
		free(inserted);
		return NULL;
	}

	fields = rz_list_newf((RzListFree)rz_bin_field_free);
	if (!fields) {
		free(inserted);
		return NULL;
	}

	rz_pvector_foreach (dex->class_defs, it) {
		class_def = (DexClassDef *)*it;
		RzList *class_fields = dex_resolve_fields_in_class(dex, class_def, inserted);
		if (class_fields) {
			rz_list_join(fields, class_fields);
			rz_list_free(class_fields);
		}
	}
	free(inserted);

	return fields;
}
RZ_API RZ_OWN RzList   *rz_bin_dex_fields(RZ_NONNULL RzBinDex *dex) {
	rz_return_val_if_fail(dex, NULL);

	DexClassDef *class_def;
	RzList *fields = NULL;
	void **it;
	ut32 n_fields = rz_pvector_len(dex->field_ids);
	ut8 *inserted = RZ_NEWS0(ut8, n_fields);
	if (n_fields > 0 && !inserted) {
		free(inserted);
		return NULL;
	}

	fields = rz_list_newf((RzListFree)rz_bin_field_free);
	if (!fields) {
		free(inserted);
		return NULL;
	}

	rz_pvector_foreach (dex->class_defs, it) {
		class_def = (DexClassDef *)*it;
		RzList *class_fields = dex_resolve_fields_in_class(dex, class_def, inserted);
		if (class_fields) {
			rz_list_join(fields, class_fields);
			rz_list_free(class_fields);
		}
	}
	free(inserted);

	return fields;
}