diff options
author | 2012-07-27 15:37:39 +0000 | |
---|---|---|
committer | 2012-07-27 15:37:39 +0000 | |
commit | 97dbb9484f6c88379bd0892a02e17023f86d9800 (patch) | |
tree | c03d5971ad8f7dcd35785cf02107311e13d3f07e /src | |
parent | b401946faeee0c3503a467e57d0bc51b06eec6f2 (diff) |
removed unnecessary strlen() usage (no whatsnew)
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/clifront.c | 16 | ||||
-rw-r--r-- | src/emu/cpu/tms32051/dis32051.c | 42 | ||||
-rw-r--r-- | src/emu/crsshair.c | 2 | ||||
-rw-r--r-- | src/emu/diimage.c | 2 | ||||
-rw-r--r-- | src/emu/dislot.c | 2 | ||||
-rw-r--r-- | src/emu/input.c | 2 | ||||
-rw-r--r-- | src/emu/mconfig.c | 2 | ||||
-rw-r--r-- | src/emu/uimain.c | 2 | ||||
-rw-r--r-- | src/emu/validity.c | 2 | ||||
-rw-r--r-- | src/mame/audio/gorf.c | 2 | ||||
-rw-r--r-- | src/mame/audio/wow.c | 2 | ||||
-rw-r--r-- | src/osd/windows/winsocket.c | 2 |
12 files changed, 39 insertions, 39 deletions
diff --git a/src/emu/clifront.c b/src/emu/clifront.c index 620393a1ee7..c248873aaae 100644 --- a/src/emu/clifront.c +++ b/src/emu/clifront.c @@ -154,10 +154,10 @@ int cli_frontend::execute(int argc, char **argv) // first parse options to be able to get software from it astring 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(); - 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()); 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()); // mount only if not already mounted - if (strlen(option) == 0) + if (*option == 0) { astring val; 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 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()); // 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); // if we have a command, execute that - if (strlen(m_options.command()) != 0) + if (*(m_options.command()) != 0) execute_commands(exename); // 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 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()); // otherwise just run the game 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 // 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 driver_enumerator drivlist(m_options); @@ -806,7 +806,7 @@ void cli_frontend::verifyroms(const char *gamename) device_iterator iter(config.root_device()); 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) { matched++; diff --git a/src/emu/cpu/tms32051/dis32051.c b/src/emu/cpu/tms32051/dis32051.c index 82666e17052..6c907673b95 100644 --- a/src/emu/cpu/tms32051/dis32051.c +++ b/src/emu/cpu/tms32051/dis32051.c @@ -462,15 +462,15 @@ CPU_DISASSEMBLE( tms32051 ) print("bcnd %04X", FETCH()); - if (strlen(zl_condition_codes[zl]) > 0) + if (*(zl_condition_codes[zl]) != 0) { 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]); } - if (strlen(tp_condition_codes[tp]) > 0) + if (*(tp_condition_codes[tp]) != 0) { print(", %s", tp_condition_codes[tp]); } @@ -489,15 +489,15 @@ CPU_DISASSEMBLE( tms32051 ) print("xc %d", n); - if (strlen(zl_condition_codes[zl]) > 0) + if (*(zl_condition_codes[zl]) != 0) { 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]); } - if (strlen(tp_condition_codes[tp]) > 0) + if (*(tp_condition_codes[tp]) != 0) { print(", %s", tp_condition_codes[tp]); } @@ -514,15 +514,15 @@ CPU_DISASSEMBLE( tms32051 ) print("cc %04X", FETCH()); - if (strlen(zl_condition_codes[zl]) > 0) + if (*(zl_condition_codes[zl]) != 0) { 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]); } - if (strlen(tp_condition_codes[tp]) > 0) + if (*(tp_condition_codes[tp]) != 0) { print(", %s", tp_condition_codes[tp]); } @@ -539,15 +539,15 @@ CPU_DISASSEMBLE( tms32051 ) print("retc "); - if (strlen(zl_condition_codes[zl]) > 0) + if (*(zl_condition_codes[zl]) != 0) { 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]); } - if (strlen(tp_condition_codes[tp]) > 0) + if (*(tp_condition_codes[tp]) != 0) { print(", %s", tp_condition_codes[tp]); } @@ -567,15 +567,15 @@ CPU_DISASSEMBLE( tms32051 ) print("bcndd %04X", FETCH()); - if (strlen(zl_condition_codes[zl]) > 0) + if (*(zl_condition_codes[zl]) != 0) { 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]); } - if (strlen(tp_condition_codes[tp]) > 0) + if (*(tp_condition_codes[tp]) != 0) { print(", %s", tp_condition_codes[tp]); } @@ -592,15 +592,15 @@ CPU_DISASSEMBLE( tms32051 ) print("ccd %04X", FETCH()); - if (strlen(zl_condition_codes[zl]) > 0) + if (*(zl_condition_codes[zl]) != 0) { 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]); } - if (strlen(tp_condition_codes[tp]) > 0) + if (*(tp_condition_codes[tp]) != 0) { print(", %s", tp_condition_codes[tp]); } @@ -617,15 +617,15 @@ CPU_DISASSEMBLE( tms32051 ) print("retcd "); - if (strlen(zl_condition_codes[zl]) > 0) + if (*(zl_condition_codes[zl]) != 0) { 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]); } - if (strlen(tp_condition_codes[tp]) > 0) + if (*(tp_condition_codes[tp]) != 0) { print(", %s", tp_condition_codes[tp]); } diff --git a/src/emu/crsshair.c b/src/emu/crsshair.c index cd4a86d427b..8a546656f28 100644 --- a/src/emu/crsshair.c +++ b/src/emu/crsshair.c @@ -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 */ - if (strlen(global.name[player]) > 0) + if (*(global.name[player]) != 0) { xml_set_attribute(crosshairnode, "pic", global.name[player]); changed = TRUE; diff --git a/src/emu/diimage.c b/src/emu/diimage.c index cd698fffcca..ce9050e0390 100644 --- a/src/emu/diimage.c +++ b/src/emu/diimage.c @@ -980,7 +980,7 @@ bool device_image_interface::load(const char *path) bool device_image_interface::open_image_file(emu_options &options) { const char* path = options.value(instance_name()); - if (strlen(path)>0) + if (*path != 0) { set_init_phase(); if (load_internal(path, FALSE, 0, NULL, TRUE)==IMAGE_INIT_PASS) diff --git a/src/emu/dislot.c b/src/emu/dislot.c index ecd504568ab..b37896bf7b1 100644 --- a/src/emu/dislot.c +++ b/src/emu/dislot.c @@ -43,7 +43,7 @@ device_t* device_slot_interface::get_card_device() } else { subtag = device().mconfig().options().value(device().tag()+1); } - if (subtag && strlen(subtag)>0) { + if (subtag && *subtag != 0) { device_slot_card_interface *intf = NULL; dev = device().subdevice(subtag); if (dev!=NULL && !dev->interface(intf)) diff --git a/src/emu/input.c b/src/emu/input.c index 3f6181d0125..3932362b7ab 100644 --- a/src/emu/input.c +++ b/src/emu/input.c @@ -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 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()) clean_index--; diff --git a/src/emu/mconfig.c b/src/emu/mconfig.c index 342d8f2c4b0..34e837c210b 100644 --- a/src/emu/mconfig.c +++ b/src/emu/mconfig.c @@ -82,7 +82,7 @@ machine_config::machine_config(const game_driver &gamedrv, emu_options &options) if (!is_selected_driver || !options.exists(owner.tag()+1)) selval = slot->get_default_card(); - if (selval != NULL && strlen(selval) != 0) + if (selval != NULL && *selval != 0) { bool found = false; for (int i = 0; intf[i].name != NULL; i++) diff --git a/src/emu/uimain.c b/src/emu/uimain.c index bb46fa777aa..b6ce828c5b7 100644 --- a/src/emu/uimain.c +++ b/src/emu/uimain.c @@ -2383,7 +2383,7 @@ void ui_menu_crosshair::populate() int found = false; /* 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; /* look for the current name, then remember the name before */ diff --git a/src/emu/validity.c b/src/emu/validity.c index e8c7abaacf9..10830753572 100644 --- a/src/emu/validity.c +++ b/src/emu/validity.c @@ -132,7 +132,7 @@ void validity_checker::validate_tag(const char *tag) begin += 1; // 0-length = bad - if (strlen(begin) == 0) + if (*begin == 0) mame_printf_error("Found 0-length tag\n"); // too short/too long = bad diff --git a/src/mame/audio/gorf.c b/src/mame/audio/gorf.c index f7393eb6e2f..5dc80d19aad 100644 --- a/src/mame/audio/gorf.c +++ b/src/mame/audio/gorf.c @@ -136,7 +136,7 @@ READ8_HANDLER( gorf_speech_r ) /* 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 */ if (state->m_plural != 0) { logerror("found a possible plural at %d\n",state->m_plural-1); diff --git a/src/mame/audio/wow.c b/src/mame/audio/wow.c index c4b8a7f8fb8..415998f49a4 100644 --- a/src/mame/audio/wow.c +++ b/src/mame/audio/wow.c @@ -129,7 +129,7 @@ READ8_HANDLER( wow_speech_r ) /* 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 */ if (state->m_plural != 0) { //logerror("found a possible plural at %d\n",state->m_plural-1); diff --git a/src/osd/windows/winsocket.c b/src/osd/windows/winsocket.c index 3e3c87435b1..058488759a3 100644 --- a/src/osd/windows/winsocket.c +++ b/src/osd/windows/winsocket.c @@ -60,7 +60,7 @@ void win_cleanup_sockets() 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 && strchr(path, ':') != NULL) return true; return false; |