mirror of
https://github.com/libretro/RetroArch
synced 2025-02-23 06:41:04 +00:00
(input) Use string_is_empty
This commit is contained in:
parent
c7eeb557fa
commit
697351ee67
@ -23,6 +23,7 @@
|
||||
|
||||
#include <dynamic/dylib.h>
|
||||
#include <retro_inline.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../../frontend/drivers/platform_linux.h"
|
||||
#include "../input_autodetect.h"
|
||||
@ -822,7 +823,7 @@ static void handle_hotplug(android_input_data_t *android_data,
|
||||
else if (strstr(device_name, "MOGA"))
|
||||
strlcpy(name_buf, "Moga IME", sizeof(name_buf));
|
||||
|
||||
else if (device_name[0] != '\0')
|
||||
else if (!string_is_empty(device_name))
|
||||
strlcpy(name_buf, device_name, sizeof(name_buf));
|
||||
|
||||
if (strstr(android_app->current_ime, "net.obsidianx.android.mogaime"))
|
||||
@ -859,7 +860,7 @@ static void handle_hotplug(android_input_data_t *android_data,
|
||||
}
|
||||
}
|
||||
|
||||
if (name_buf[0] != '\0')
|
||||
if (!string_is_empty(name_buf))
|
||||
{
|
||||
strlcpy(settings->input.device_names[*port],
|
||||
name_buf, sizeof(settings->input.device_names[*port]));
|
||||
|
@ -15,13 +15,14 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <boolean.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include <screen/screen.h>
|
||||
#include <bps/event.h>
|
||||
#include <bps/navigator.h>
|
||||
#include <sys/keycodes.h>
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#include "../../general.h"
|
||||
#include "../../driver.h"
|
||||
#include "../input_autodetect.h"
|
||||
@ -200,7 +201,7 @@ static void qnx_input_autodetect_gamepad(qnx_input_t *qnx,
|
||||
#endif
|
||||
}
|
||||
|
||||
if (name_buf[0] != '\0')
|
||||
if (!string_is_empty(name_buf))
|
||||
{
|
||||
autoconfig_params_t params = {{0}};
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include <IOKit/hid/IOHIDManager.h>
|
||||
#include <IOKit/hid/IOHIDKeys.h>
|
||||
|
||||
@ -340,7 +342,7 @@ static void iohidmanager_hid_device_add(void *data, IOReturn result,
|
||||
IOHIDDeviceRegisterInputValueCallback(device,
|
||||
iohidmanager_hid_device_input_callback, adapter);
|
||||
|
||||
if (adapter->name[0] == '\0')
|
||||
if (string_is_empty(adapter->name))
|
||||
return;
|
||||
|
||||
strlcpy(settings->input.device_names[adapter->slot],
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <rthreads/rthreads.h>
|
||||
#include <compat/strl.h>
|
||||
#include <queues/fifo_buffer.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../connect/joypad_connection.h"
|
||||
#include "../input_autodetect.h"
|
||||
@ -264,7 +265,7 @@ static int add_adapter(void *data, struct libusb_device *dev)
|
||||
|
||||
device_name = (const char*)adapter->name;
|
||||
|
||||
if (adapter->name[0] == '\0')
|
||||
if (string_is_empty((const char*)adapter->name))
|
||||
goto error;
|
||||
|
||||
adapter->send_control_lock = slock_new();
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include <linux/input.h>
|
||||
|
||||
#include <retro_inline.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "../input_autodetect.h"
|
||||
#include "../../general.h"
|
||||
@ -375,7 +376,7 @@ static void udev_free_pad(unsigned pad)
|
||||
if (udev_pads[pad].path)
|
||||
free(udev_pads[pad].path);
|
||||
udev_pads[pad].path = NULL;
|
||||
if (udev_pads[pad].ident[0] != '\0')
|
||||
if (!string_is_empty(udev_pads[pad].ident))
|
||||
udev_pads[pad].ident[0] = '\0';
|
||||
|
||||
memset(&udev_pads[pad], 0, sizeof(udev_pads[pad]));
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <file/dir_list.h>
|
||||
#include <file/file_path.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "input_config.h"
|
||||
#include "input_autodetect.h"
|
||||
@ -107,7 +108,7 @@ static int input_try_autoconfigure_joypad_from_conf(config_file_t *conf,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ident[0] != '\0' && !strncmp(params->name, ident, strlen(ident)))
|
||||
if (!string_is_empty(ident) && !strncmp(params->name, ident, strlen(ident)))
|
||||
{
|
||||
score += 1;
|
||||
#if 0
|
||||
@ -147,7 +148,7 @@ static void input_autoconfigure_joypad_add(config_file_t *conf, autoconfig_param
|
||||
|
||||
if (!strcmp(device_type,"remote"))
|
||||
{
|
||||
if (display_name[0] != '\0' || strcmp(display_name, ""))
|
||||
if (!string_is_empty(display_name) || strcmp(display_name, ""))
|
||||
snprintf(msg, sizeof(msg), "%s configured",
|
||||
display_name);
|
||||
else
|
||||
@ -160,7 +161,7 @@ static void input_autoconfigure_joypad_add(config_file_t *conf, autoconfig_param
|
||||
}
|
||||
else
|
||||
{
|
||||
if (display_name[0] != '\0' || strcmp(display_name, ""))
|
||||
if (!string_is_empty(display_name) || strcmp(display_name, ""))
|
||||
snprintf(msg, sizeof(msg), "%s configured in port #%u.",
|
||||
display_name, params->idx);
|
||||
else
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include <file/file_path.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "input_config.h"
|
||||
#include "input_keymaps.h"
|
||||
@ -376,7 +377,7 @@ static void input_config_get_bind_string_joykey(char *buf, const char *prefix,
|
||||
break;
|
||||
}
|
||||
|
||||
if (bind->joykey_label[0] != '\0' && settings->input.input_descriptor_label_show)
|
||||
if (!string_is_empty(bind->joykey_label) && settings->input.input_descriptor_label_show)
|
||||
snprintf(buf, size, "%s %s ", prefix, bind->joykey_label);
|
||||
else
|
||||
snprintf(buf, size, "%sHat #%u %s ", prefix,
|
||||
@ -384,7 +385,7 @@ static void input_config_get_bind_string_joykey(char *buf, const char *prefix,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bind->joykey_label[0] != '\0' && settings->input.input_descriptor_label_show)
|
||||
if (!string_is_empty(bind->joykey_label) && settings->input.input_descriptor_label_show)
|
||||
snprintf(buf, size, "%s%s (btn) ", prefix, bind->joykey_label);
|
||||
else
|
||||
snprintf(buf, size, "%s%u (btn) ", prefix, (unsigned)bind->joykey);
|
||||
@ -408,7 +409,7 @@ static void input_config_get_bind_string_joyaxis(char *buf, const char *prefix,
|
||||
dir = '+';
|
||||
axis = AXIS_POS_GET(bind->joyaxis);
|
||||
}
|
||||
if (bind->joyaxis_label[0] != '\0' && settings->input.input_descriptor_label_show)
|
||||
if (!string_is_empty(bind->joyaxis_label) && settings->input.input_descriptor_label_show)
|
||||
snprintf(buf, size, "%s%s (axis) ", prefix, bind->joyaxis_label);
|
||||
else
|
||||
snprintf(buf, size, "%s%c%u (axis) ", prefix, dir, axis);
|
||||
|
@ -13,9 +13,11 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "input_remapping.h"
|
||||
#include <file/config_file.h>
|
||||
#include <file/file_path.h>
|
||||
#include <string/stdstring.h>
|
||||
|
||||
#include "input_remapping.h"
|
||||
|
||||
#include "../general.h"
|
||||
|
||||
@ -33,7 +35,7 @@ bool input_remapping_load_file(void *data, const char *path)
|
||||
config_file_t *conf = (config_file_t*)data;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!conf || path[0] == '\0')
|
||||
if (!conf || string_is_empty(path))
|
||||
return false;
|
||||
|
||||
strlcpy(settings->input.remapping_path, path,
|
||||
|
Loading…
x
Reference in New Issue
Block a user