Skip to content

Commit

Permalink
Make db_update part of the global db context.
Browse files Browse the repository at this point in the history
  • Loading branch information
starseeker committed Dec 7, 2024
1 parent 423f354 commit 35ebefd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/mged/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ struct cmd_list head_cmd_list;
struct cmd_list *curr_cmd_list;

extern int mged_db_warn;
extern int mged_db_upgrade;
extern int mged_db_version;

static int glob_compat_mode = 1;
Expand Down Expand Up @@ -1646,7 +1645,7 @@ mged_global_variable_setup(struct mged_state *s)
{
Tcl_LinkVar(s->interp, "mged_default(dlist)", (char *)&mged_default_dlist, TCL_LINK_INT);
Tcl_LinkVar(s->interp, "mged_default(db_warn)", (char *)&mged_db_warn, TCL_LINK_INT);
Tcl_LinkVar(s->interp, "mged_default(db_upgrade)", (char *)&mged_db_upgrade, TCL_LINK_INT);
Tcl_LinkVar(s->interp, "mged_default(db_upgrade)", (char *)&mged_global_db_ctx.db_upgrade, TCL_LINK_INT);
Tcl_LinkVar(s->interp, "mged_default(db_version)", (char *)&mged_db_version, TCL_LINK_INT);

Tcl_LinkVar(s->interp, "edit_class", (char *)&es_edclass, TCL_LINK_INT);
Expand Down
2 changes: 1 addition & 1 deletion src/mged/f_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ mged_post_opendb_clbk(int UNUSED(ac), const char **UNUSED(argv), void *vgedp, vo
* creating a new database.
*/
if (db_version(s->dbip) < 5 && !mctx->created_new_db) {
if (mged_db_upgrade) {
if (mctx->db_upgrade) {
if (mged_db_warn)
bu_vls_printf(gedp->ged_result_str, "Warning:\n\tDatabase version is old.\n\tConverting to the new format.\n");

Expand Down
7 changes: 1 addition & 6 deletions src/mged/mged.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,6 @@ int old_mged_gui=1;
*/
int mged_db_warn = 0;

/*
* 0 - no upgrade
* 1 - upgrade
*/
int mged_db_upgrade = 0;

/* force creation of specific database versions */
int mged_db_version = BRLCAD_DB_FORMAT_LATEST;

Expand Down Expand Up @@ -1852,6 +1846,7 @@ main(int argc, char *argv[])

// Start out in an initialization state
mged_global_db_ctx.init_flag = 1;
mged_global_db_ctx.db_upgrade = 0; // no upgrade

char *attach = (char *)NULL;

Expand Down
2 changes: 1 addition & 1 deletion src/mged/mged.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ struct cmdtab {
#include "./menu.h"

/* initialization states */
extern int mged_db_upgrade;
extern int mged_db_version;
extern int mged_db_warn;

Expand Down Expand Up @@ -443,6 +442,7 @@ struct mged_opendb_ctx {
int post_open_cnt;
struct mged_state *s;
int init_flag; /* >0 means in initialization stage */
int db_upgrade; /* 0 (default) no upgrade, 1 upgrade */
};
extern struct mged_opendb_ctx mged_global_db_ctx;

Expand Down

0 comments on commit 35ebefd

Please sign in to comment.