mirror of
https://github.com/holub/mame
synced 2025-05-17 11:15:06 +03:00
removed unnecessary strlen() usage (no whatsnew)
This commit is contained in:
parent
b401946fae
commit
97dbb9484f
@ -154,10 +154,10 @@ int cli_frontend::execute(int argc, char **argv)
|
|||||||
// first parse options to be able to get software from it
|
// first parse options to be able to get software from it
|
||||||
astring option_errors;
|
astring option_errors;
|
||||||
m_options.parse_command_line(argc, argv, option_errors);
|
m_options.parse_command_line(argc, argv, option_errors);
|
||||||
if (strlen(m_options.software_name()) > 0)
|
if (*(m_options.software_name()) != 0)
|
||||||
{
|
{
|
||||||
const game_driver *system = m_options.system();
|
const game_driver *system = m_options.system();
|
||||||
if (system == NULL && strlen(m_options.system_name()) > 0)
|
if (system == NULL && *(m_options.system_name()) != 0)
|
||||||
throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name());
|
throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name());
|
||||||
|
|
||||||
machine_config config(*system, m_options);
|
machine_config config(*system, m_options);
|
||||||
@ -193,7 +193,7 @@ int cli_frontend::execute(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
const char *option = m_options.value(image->brief_instance_name());
|
const char *option = m_options.value(image->brief_instance_name());
|
||||||
// mount only if not already mounted
|
// mount only if not already mounted
|
||||||
if (strlen(option) == 0)
|
if (*option == 0)
|
||||||
{
|
{
|
||||||
astring val;
|
astring val;
|
||||||
val.printf("%s:%s:%s",swlist->list_name(),m_options.software_name(),swpart->name);
|
val.printf("%s:%s:%s",swlist->list_name(),m_options.software_name(),swpart->name);
|
||||||
@ -224,7 +224,7 @@ int cli_frontend::execute(int argc, char **argv)
|
|||||||
if (!m_options.parse_command_line(argc, argv, option_errors))
|
if (!m_options.parse_command_line(argc, argv, option_errors))
|
||||||
{
|
{
|
||||||
// if we failed, check for no command and a system name first; in that case error on the name
|
// if we failed, check for no command and a system name first; in that case error on the name
|
||||||
if (strlen(m_options.command()) == 0 && m_options.system() == NULL && strlen(m_options.system_name()) > 0)
|
if (*(m_options.command()) == 0 && m_options.system() == NULL && *(m_options.system_name()) != 0)
|
||||||
throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name());
|
throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name());
|
||||||
|
|
||||||
// otherwise, error on the options
|
// otherwise, error on the options
|
||||||
@ -238,7 +238,7 @@ int cli_frontend::execute(int argc, char **argv)
|
|||||||
core_filename_extract_base(exename, argv[0], true);
|
core_filename_extract_base(exename, argv[0], true);
|
||||||
|
|
||||||
// if we have a command, execute that
|
// if we have a command, execute that
|
||||||
if (strlen(m_options.command()) != 0)
|
if (*(m_options.command()) != 0)
|
||||||
execute_commands(exename);
|
execute_commands(exename);
|
||||||
|
|
||||||
// otherwise, check for a valid system
|
// otherwise, check for a valid system
|
||||||
@ -246,7 +246,7 @@ int cli_frontend::execute(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
// if we can't find it, give an appropriate error
|
// if we can't find it, give an appropriate error
|
||||||
const game_driver *system = m_options.system();
|
const game_driver *system = m_options.system();
|
||||||
if (system == NULL && strlen(m_options.system_name()) > 0)
|
if (system == NULL && *(m_options.system_name()) != 0)
|
||||||
throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name());
|
throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", m_options.system_name());
|
||||||
// otherwise just run the game
|
// otherwise just run the game
|
||||||
m_result = mame_execute(m_options, m_osd);
|
m_result = mame_execute(m_options, m_osd);
|
||||||
@ -262,7 +262,7 @@ int cli_frontend::execute(int argc, char **argv)
|
|||||||
|
|
||||||
// if a game was specified, wasn't a wildcard, and our error indicates this was the
|
// if a game was specified, wasn't a wildcard, and our error indicates this was the
|
||||||
// reason for failure, offer some suggestions
|
// reason for failure, offer some suggestions
|
||||||
if (m_result == MAMERR_NO_SUCH_GAME && strlen(m_options.system_name()) > 0 && strchr(m_options.system_name(), '*') == NULL && m_options.system() == NULL)
|
if (m_result == MAMERR_NO_SUCH_GAME && *(m_options.system_name()) != 0 && strchr(m_options.system_name(), '*') == NULL && m_options.system() == NULL)
|
||||||
{
|
{
|
||||||
// get the top 10 approximate matches
|
// get the top 10 approximate matches
|
||||||
driver_enumerator drivlist(m_options);
|
driver_enumerator drivlist(m_options);
|
||||||
@ -806,7 +806,7 @@ void cli_frontend::verifyroms(const char *gamename)
|
|||||||
device_iterator iter(config.root_device());
|
device_iterator iter(config.root_device());
|
||||||
for (device_t *dev = iter.first(); dev != NULL; dev = iter.next())
|
for (device_t *dev = iter.first(); dev != NULL; dev = iter.next())
|
||||||
{
|
{
|
||||||
if (dev->owner() != NULL && (strlen(dev->shortname())>0) && dev->rom_region() != NULL && (device_map.add(dev->shortname(), 0, false) != TMERR_DUPLICATE)) {
|
if (dev->owner() != NULL && (*(dev->shortname()) != 0) && dev->rom_region() != NULL && (device_map.add(dev->shortname(), 0, false) != TMERR_DUPLICATE)) {
|
||||||
if (mame_strwildcmp(gamename, dev->shortname()) == 0)
|
if (mame_strwildcmp(gamename, dev->shortname()) == 0)
|
||||||
{
|
{
|
||||||
matched++;
|
matched++;
|
||||||
|
@ -462,15 +462,15 @@ CPU_DISASSEMBLE( tms32051 )
|
|||||||
|
|
||||||
print("bcnd %04X", FETCH());
|
print("bcnd %04X", FETCH());
|
||||||
|
|
||||||
if (strlen(zl_condition_codes[zl]) > 0)
|
if (*(zl_condition_codes[zl]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", zl_condition_codes[zl]);
|
print(", %s", zl_condition_codes[zl]);
|
||||||
}
|
}
|
||||||
if (strlen(cv_condition_codes[cv]) > 0)
|
if (*(cv_condition_codes[cv]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", cv_condition_codes[cv]);
|
print(", %s", cv_condition_codes[cv]);
|
||||||
}
|
}
|
||||||
if (strlen(tp_condition_codes[tp]) > 0)
|
if (*(tp_condition_codes[tp]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", tp_condition_codes[tp]);
|
print(", %s", tp_condition_codes[tp]);
|
||||||
}
|
}
|
||||||
@ -489,15 +489,15 @@ CPU_DISASSEMBLE( tms32051 )
|
|||||||
|
|
||||||
print("xc %d", n);
|
print("xc %d", n);
|
||||||
|
|
||||||
if (strlen(zl_condition_codes[zl]) > 0)
|
if (*(zl_condition_codes[zl]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", zl_condition_codes[zl]);
|
print(", %s", zl_condition_codes[zl]);
|
||||||
}
|
}
|
||||||
if (strlen(cv_condition_codes[cv]) > 0)
|
if (*(cv_condition_codes[cv]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", cv_condition_codes[cv]);
|
print(", %s", cv_condition_codes[cv]);
|
||||||
}
|
}
|
||||||
if (strlen(tp_condition_codes[tp]) > 0)
|
if (*(tp_condition_codes[tp]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", tp_condition_codes[tp]);
|
print(", %s", tp_condition_codes[tp]);
|
||||||
}
|
}
|
||||||
@ -514,15 +514,15 @@ CPU_DISASSEMBLE( tms32051 )
|
|||||||
|
|
||||||
print("cc %04X", FETCH());
|
print("cc %04X", FETCH());
|
||||||
|
|
||||||
if (strlen(zl_condition_codes[zl]) > 0)
|
if (*(zl_condition_codes[zl]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", zl_condition_codes[zl]);
|
print(", %s", zl_condition_codes[zl]);
|
||||||
}
|
}
|
||||||
if (strlen(cv_condition_codes[cv]) > 0)
|
if (*(cv_condition_codes[cv]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", cv_condition_codes[cv]);
|
print(", %s", cv_condition_codes[cv]);
|
||||||
}
|
}
|
||||||
if (strlen(tp_condition_codes[tp]) > 0)
|
if (*(tp_condition_codes[tp]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", tp_condition_codes[tp]);
|
print(", %s", tp_condition_codes[tp]);
|
||||||
}
|
}
|
||||||
@ -539,15 +539,15 @@ CPU_DISASSEMBLE( tms32051 )
|
|||||||
|
|
||||||
print("retc ");
|
print("retc ");
|
||||||
|
|
||||||
if (strlen(zl_condition_codes[zl]) > 0)
|
if (*(zl_condition_codes[zl]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", zl_condition_codes[zl]);
|
print(", %s", zl_condition_codes[zl]);
|
||||||
}
|
}
|
||||||
if (strlen(cv_condition_codes[cv]) > 0)
|
if (*(cv_condition_codes[cv]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", cv_condition_codes[cv]);
|
print(", %s", cv_condition_codes[cv]);
|
||||||
}
|
}
|
||||||
if (strlen(tp_condition_codes[tp]) > 0)
|
if (*(tp_condition_codes[tp]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", tp_condition_codes[tp]);
|
print(", %s", tp_condition_codes[tp]);
|
||||||
}
|
}
|
||||||
@ -567,15 +567,15 @@ CPU_DISASSEMBLE( tms32051 )
|
|||||||
|
|
||||||
print("bcndd %04X", FETCH());
|
print("bcndd %04X", FETCH());
|
||||||
|
|
||||||
if (strlen(zl_condition_codes[zl]) > 0)
|
if (*(zl_condition_codes[zl]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", zl_condition_codes[zl]);
|
print(", %s", zl_condition_codes[zl]);
|
||||||
}
|
}
|
||||||
if (strlen(cv_condition_codes[cv]) > 0)
|
if (*(cv_condition_codes[cv]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", cv_condition_codes[cv]);
|
print(", %s", cv_condition_codes[cv]);
|
||||||
}
|
}
|
||||||
if (strlen(tp_condition_codes[tp]) > 0)
|
if (*(tp_condition_codes[tp]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", tp_condition_codes[tp]);
|
print(", %s", tp_condition_codes[tp]);
|
||||||
}
|
}
|
||||||
@ -592,15 +592,15 @@ CPU_DISASSEMBLE( tms32051 )
|
|||||||
|
|
||||||
print("ccd %04X", FETCH());
|
print("ccd %04X", FETCH());
|
||||||
|
|
||||||
if (strlen(zl_condition_codes[zl]) > 0)
|
if (*(zl_condition_codes[zl]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", zl_condition_codes[zl]);
|
print(", %s", zl_condition_codes[zl]);
|
||||||
}
|
}
|
||||||
if (strlen(cv_condition_codes[cv]) > 0)
|
if (*(cv_condition_codes[cv]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", cv_condition_codes[cv]);
|
print(", %s", cv_condition_codes[cv]);
|
||||||
}
|
}
|
||||||
if (strlen(tp_condition_codes[tp]) > 0)
|
if (*(tp_condition_codes[tp]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", tp_condition_codes[tp]);
|
print(", %s", tp_condition_codes[tp]);
|
||||||
}
|
}
|
||||||
@ -617,15 +617,15 @@ CPU_DISASSEMBLE( tms32051 )
|
|||||||
|
|
||||||
print("retcd ");
|
print("retcd ");
|
||||||
|
|
||||||
if (strlen(zl_condition_codes[zl]) > 0)
|
if (*(zl_condition_codes[zl]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", zl_condition_codes[zl]);
|
print(", %s", zl_condition_codes[zl]);
|
||||||
}
|
}
|
||||||
if (strlen(cv_condition_codes[cv]) > 0)
|
if (*(cv_condition_codes[cv]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", cv_condition_codes[cv]);
|
print(", %s", cv_condition_codes[cv]);
|
||||||
}
|
}
|
||||||
if (strlen(tp_condition_codes[tp]) > 0)
|
if (*(tp_condition_codes[tp]) != 0)
|
||||||
{
|
{
|
||||||
print(", %s", tp_condition_codes[tp]);
|
print(", %s", tp_condition_codes[tp]);
|
||||||
}
|
}
|
||||||
|
@ -507,7 +507,7 @@ static void crosshair_save(running_machine &machine, int config_type, xml_data_n
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* the default graphic name is "", so only save if not */
|
/* the default graphic name is "", so only save if not */
|
||||||
if (strlen(global.name[player]) > 0)
|
if (*(global.name[player]) != 0)
|
||||||
{
|
{
|
||||||
xml_set_attribute(crosshairnode, "pic", global.name[player]);
|
xml_set_attribute(crosshairnode, "pic", global.name[player]);
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
|
@ -980,7 +980,7 @@ bool device_image_interface::load(const char *path)
|
|||||||
bool device_image_interface::open_image_file(emu_options &options)
|
bool device_image_interface::open_image_file(emu_options &options)
|
||||||
{
|
{
|
||||||
const char* path = options.value(instance_name());
|
const char* path = options.value(instance_name());
|
||||||
if (strlen(path)>0)
|
if (*path != 0)
|
||||||
{
|
{
|
||||||
set_init_phase();
|
set_init_phase();
|
||||||
if (load_internal(path, FALSE, 0, NULL, TRUE)==IMAGE_INIT_PASS)
|
if (load_internal(path, FALSE, 0, NULL, TRUE)==IMAGE_INIT_PASS)
|
||||||
|
@ -43,7 +43,7 @@ device_t* device_slot_interface::get_card_device()
|
|||||||
} else {
|
} else {
|
||||||
subtag = device().mconfig().options().value(device().tag()+1);
|
subtag = device().mconfig().options().value(device().tag()+1);
|
||||||
}
|
}
|
||||||
if (subtag && strlen(subtag)>0) {
|
if (subtag && *subtag != 0) {
|
||||||
device_slot_card_interface *intf = NULL;
|
device_slot_card_interface *intf = NULL;
|
||||||
dev = device().subdevice(subtag);
|
dev = device().subdevice(subtag);
|
||||||
if (dev!=NULL && !dev->interface(intf))
|
if (dev!=NULL && !dev->interface(intf))
|
||||||
|
@ -2002,7 +2002,7 @@ const char *input_manager::seq_name(astring &string, const input_seq &seq) const
|
|||||||
{
|
{
|
||||||
// if this is a code item which is not valid, don't copy it and remove any preceding ORs/NOTs
|
// if this is a code item which is not valid, don't copy it and remove any preceding ORs/NOTs
|
||||||
input_code code = seq[codenum];
|
input_code code = seq[codenum];
|
||||||
if (!code.internal() && strlen(code_name(codestr, code)) == 0)
|
if (!code.internal() && *(code_name(codestr, code)) == 0)
|
||||||
{
|
{
|
||||||
while (clean_index > 0 && clean_codes[clean_index - 1].internal())
|
while (clean_index > 0 && clean_codes[clean_index - 1].internal())
|
||||||
clean_index--;
|
clean_index--;
|
||||||
|
@ -82,7 +82,7 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options)
|
|||||||
if (!is_selected_driver || !options.exists(owner.tag()+1))
|
if (!is_selected_driver || !options.exists(owner.tag()+1))
|
||||||
selval = slot->get_default_card();
|
selval = slot->get_default_card();
|
||||||
|
|
||||||
if (selval != NULL && strlen(selval) != 0)
|
if (selval != NULL && *selval != 0)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (int i = 0; intf[i].name != NULL; i++)
|
for (int i = 0; intf[i].name != NULL; i++)
|
||||||
|
@ -2383,7 +2383,7 @@ void ui_menu_crosshair::populate()
|
|||||||
int found = false;
|
int found = false;
|
||||||
|
|
||||||
/* if we are using the default, then we just need to find the first in the list */
|
/* if we are using the default, then we just need to find the first in the list */
|
||||||
if (strlen(settings.name) == 0)
|
if (*(settings.name) == 0)
|
||||||
using_default = true;
|
using_default = true;
|
||||||
|
|
||||||
/* look for the current name, then remember the name before */
|
/* look for the current name, then remember the name before */
|
||||||
|
@ -132,7 +132,7 @@ void validity_checker::validate_tag(const char *tag)
|
|||||||
begin += 1;
|
begin += 1;
|
||||||
|
|
||||||
// 0-length = bad
|
// 0-length = bad
|
||||||
if (strlen(begin) == 0)
|
if (*begin == 0)
|
||||||
mame_printf_error("Found 0-length tag\n");
|
mame_printf_error("Found 0-length tag\n");
|
||||||
|
|
||||||
// too short/too long = bad
|
// too short/too long = bad
|
||||||
|
@ -136,7 +136,7 @@ READ8_HANDLER( gorf_speech_r )
|
|||||||
|
|
||||||
/* Phoneme to word translation */
|
/* Phoneme to word translation */
|
||||||
|
|
||||||
if (strlen(state->m_totalword) == 0) {
|
if (*(state->m_totalword) == 0) {
|
||||||
strcpy(state->m_totalword,PhonemeTable[Phoneme]); /* Copy over the first phoneme */
|
strcpy(state->m_totalword,PhonemeTable[Phoneme]); /* Copy over the first phoneme */
|
||||||
if (state->m_plural != 0) {
|
if (state->m_plural != 0) {
|
||||||
logerror("found a possible plural at %d\n",state->m_plural-1);
|
logerror("found a possible plural at %d\n",state->m_plural-1);
|
||||||
|
@ -129,7 +129,7 @@ READ8_HANDLER( wow_speech_r )
|
|||||||
|
|
||||||
/* Phoneme to word translation */
|
/* Phoneme to word translation */
|
||||||
|
|
||||||
if (strlen(state->m_totalword) == 0) {
|
if (*(state->m_totalword) == 0) {
|
||||||
strcpy(state->m_totalword,PhonemeTable[Phoneme]); /* Copy over the first phoneme */
|
strcpy(state->m_totalword,PhonemeTable[Phoneme]); /* Copy over the first phoneme */
|
||||||
if (state->m_plural != 0) {
|
if (state->m_plural != 0) {
|
||||||
//logerror("found a possible plural at %d\n",state->m_plural-1);
|
//logerror("found a possible plural at %d\n",state->m_plural-1);
|
||||||
|
@ -60,7 +60,7 @@ void win_cleanup_sockets()
|
|||||||
|
|
||||||
bool win_check_socket_path(const char *path)
|
bool win_check_socket_path(const char *path)
|
||||||
{
|
{
|
||||||
if (strlen(winfile_socket_identifier) > 0 &&
|
if (*winfile_socket_identifier != 0 &&
|
||||||
strncmp(path, winfile_socket_identifier, strlen(winfile_socket_identifier)) == 0 &&
|
strncmp(path, winfile_socket_identifier, strlen(winfile_socket_identifier)) == 0 &&
|
||||||
strchr(path, ':') != NULL) return true;
|
strchr(path, ':') != NULL) return true;
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user