static void
reinit_database(gchar *newdb)
{
-if (_mapper_db)
- g_free(_mapper_db);
-_mapper_db=newdb;
-
-if (_db || newdb==NULL) {
+if (_db) {
poi_deinit(_db);
osm_deinit();
db_close(&_db);
_db=NULL;
- if (newdb==NULL)
- return;
}
+if (_mapper_db) {
+ g_free(_mapper_db);
+ _mapper_db=NULL;
+}
+_mapper_db=newdb;
+if (_mapper_db==NULL)
+ return;
db_connect(&_db, _mapper_db);
poi_init(&_db);
osm_init(&_db);
reinit_database(tmp);
}
} else {
- _mapper_db=NULL;
reinit_database(NULL);
}
config_save();