Skip to content

Commit

Permalink
Move rz_core_project_*() API to the project.c
Browse files Browse the repository at this point in the history
  • Loading branch information
XVilka committed Sep 7, 2022
1 parent 2079231 commit bdc0530
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
17 changes: 0 additions & 17 deletions librz/core/cmd/cmd_project.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,6 @@

#include <rz_project.h>

RZ_API bool rz_core_project_load_for_cli(RzCore *core, const char *file, bool load_bin_io) {
RzSerializeResultInfo *res = rz_serialize_result_info_new();
RzProjectErr err = rz_project_load_file(core, file, load_bin_io, res);
if (err != RZ_PROJECT_ERR_SUCCESS) {
RZ_LOG_ERROR("core: Failed to load project: %s\n", rz_project_err_message(err));
} else if (!rz_list_empty(res)) {
rz_cons_printf("Detailed project load info:\n");
}
RzListIter *it;
char *s;
rz_list_foreach (res, it, s) {
rz_cons_printf(" %s\n", s);
}
rz_serialize_result_info_free(res);
return err == RZ_PROJECT_ERR_SUCCESS;
}

RZ_IPI RzCmdStatus rz_project_save_handler(RzCore *core, int argc, const char **argv) {
const char *file;
if (argc == 1) {
Expand Down
17 changes: 17 additions & 0 deletions librz/core/project.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,20 @@ RZ_API RzProjectErr rz_project_load_file(RzCore *core, const char *file, bool lo
sdb_free(prj);
return ret;
}

RZ_API bool rz_core_project_load_for_cli(RzCore *core, const char *file, bool load_bin_io) {
RzSerializeResultInfo *res = rz_serialize_result_info_new();
RzProjectErr err = rz_project_load_file(core, file, load_bin_io, res);
if (err != RZ_PROJECT_ERR_SUCCESS) {
RZ_LOG_ERROR("core: Failed to load project: %s\n", rz_project_err_message(err));
} else if (!rz_list_empty(res)) {
rz_cons_printf("Detailed project load info:\n");
}
RzListIter *it;
char *s;
rz_list_foreach (res, it, s) {
rz_cons_printf(" %s\n", s);
}
rz_serialize_result_info_free(res);
return err == RZ_PROJECT_ERR_SUCCESS;
}

0 comments on commit bdc0530

Please sign in to comment.