void libgretl_cleanup (void) { libgretl_session_cleanup(SESSION_CLEAR_ALL); gretl_rand_free(); gretl_functions_cleanup(); libset_cleanup(); gretl_command_hash_cleanup(); gretl_function_hash_cleanup(); lapack_mem_free(); forecast_matrix_cleanup(); option_flags_cleanup(); kalman_cleanup(); gnuplot_cleanup(); bufgets_cleanup(); #ifdef USE_CURL gretl_www_cleanup(); #endif builtin_strings_cleanup(); #ifdef USE_RLIB gretl_R_cleanup(); #endif gretl_xml_cleanup(); }
static int cli_clear_data (CMD *cmd, DATASET *dset, MODEL *model) { gretlopt clearopt = 0; int err = 0; if (cmd->ci == CLEAR) { clearopt = cmd->opt; } else if (cmd->opt & OPT_P) { /* --preserve: clear dataset only */ clearopt = OPT_D; } else if (csv_open_needs_matrix(cmd->opt)) { clearopt = OPT_D; } *datafile = '\0'; if (dset->Z != NULL) { err = restore_full_sample(dset, NULL); free_Z(dset); } clear_datainfo(dset, CLEAR_FULL); data_status = 0; clear_model(model); if (clearopt & OPT_D) { libgretl_session_cleanup(SESSION_CLEAR_DATASET); } else { libgretl_session_cleanup(SESSION_CLEAR_ALL); } set_model_count(0); gretl_cmd_destroy_context(cmd); return err; }