Get rid of machine_get_machine_from_internal_name_ex

This commit is contained in:
Alexander Babikov
2026-01-01 16:41:23 +05:00
parent 2b99bf64bd
commit 46d0d90f8d
4 changed files with 11 additions and 22 deletions

View File

@@ -349,16 +349,21 @@ load_machine(void)
for (i = 0; machine_migrations[i].old; i++) {
if (!strcmp(p, machine_migrations[i].old)) {
machine = machine_get_machine_from_internal_name(machine_migrations[i].new);
migrate_from = p;
if (machine_migrations[i].new_bios) {
migration_cat = ini_find_or_create_section(config, machine_get_device(machine)->name);
ini_section_set_string(migration_cat, "bios", machine_migrations[i].new_bios);
if (machine != -1) {
migrate_from = p;
if (machine_migrations[i].new_bios) {
migration_cat = ini_find_or_create_section(config, machine_get_device(machine)->name);
ini_section_set_string(migration_cat, "bios", machine_migrations[i].new_bios);
}
}
break;
}
}
if (!migrate_from)
if (!migrate_from) {
machine = machine_get_machine_from_internal_name(p);
if (machine == -1)
machine = 0;
}
} else {
machine = 0;
}

View File

@@ -391,7 +391,6 @@ extern const char * machine_getname(int m);
extern const char * machine_get_internal_name(void);
extern const char * machine_get_nvr_name(void);
extern int machine_get_machine_from_internal_name(const char *s);
extern int machine_get_machine_from_internal_name_ex(const char *s); /* returns -1 if internal name does not exist. */
extern void machine_init(void);
#ifdef EMU_DEVICE_H
extern const device_t *machine_get_kbc_device(int m);

View File

@@ -20700,21 +20700,6 @@ machine_get_machine_from_internal_name(const char *s)
c++;
}
return 0;
}
int
machine_get_machine_from_internal_name_ex(const char *s)
{
int c = 0;
while (machines[c].init != NULL) {
if (!strcmp(machines[c].internal_name, s))
return c;
c++;
}
return -1;
}

View File

@@ -521,7 +521,7 @@ VMManagerSystem::setupVars()
auto machine_name = QString();
int i = 0;
int ram_granularity = 0;
int ci = machine_get_machine_from_internal_name_ex(machine_config["machine"].toUtf8());
int ci = machine_get_machine_from_internal_name(machine_config["machine"].toUtf8());
// Machine
if (ci != -1 && machine_available(ci)) {
machine_name = machines[ci].name;