diff options
author | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-05-06 16:20:20 +0200 |
---|---|---|
committer | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-05-08 12:37:42 +0200 |
commit | a0dbdcc3abbd3e6307c6e68d0e60f8c0fa31d576 (patch) | |
tree | 0b8d0a36f69e28096b06956ebbe2c5e6f7e403a3 /platform/linuxbsd | |
parent | 281fe39929303a8ef12e72ff7999b849bbe0678d (diff) | |
download | redot-engine-a0dbdcc3abbd3e6307c6e68d0e60f8c0fa31d576.tar.gz |
Replace `find` with `contains/has` where applicable
* Replaces `find(...) != -1` with `contains` for `String`
* Replaces `find(...) == -1` with `!contains` for `String`
* Replaces `find(...) != -1` with `has` for containers
* Replaces `find(...) == -1` with `!has` for containers
Diffstat (limited to 'platform/linuxbsd')
-rw-r--r-- | platform/linuxbsd/joypad_linux.cpp | 6 | ||||
-rw-r--r-- | platform/linuxbsd/os_linuxbsd.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp index 827c567785..6e546c4531 100644 --- a/platform/linuxbsd/joypad_linux.cpp +++ b/platform/linuxbsd/joypad_linux.cpp @@ -175,7 +175,7 @@ void JoypadLinux::enumerate_joypads(udev *p_udev) { if (devnode) { String devnode_str = devnode; - if (devnode_str.find(ignore_str) == -1) { + if (!devnode_str.contains(ignore_str)) { open_joypad(devnode); } } @@ -214,7 +214,7 @@ void JoypadLinux::monitor_joypads(udev *p_udev) { const char *devnode = udev_device_get_devnode(dev); if (devnode) { String devnode_str = devnode; - if (devnode_str.find(ignore_str) == -1) { + if (!devnode_str.contains(ignore_str)) { if (action == "add") { open_joypad(devnode); } else if (String(action) == "remove") { @@ -244,7 +244,7 @@ void JoypadLinux::monitor_joypads() { continue; } sprintf(fname, "/dev/input/%.*s", 16, current->d_name); - if (attached_devices.find(fname) == -1) { + if (!attached_devices.has(fname)) { open_joypad(fname); } } diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index 68b4cd7f5a..6355562feb 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -184,7 +184,7 @@ String OS_LinuxBSD::get_processor_name() const { while (!f->eof_reached()) { const String line = f->get_line(); - if (line.find("model name") != -1) { + if (line.contains("model name")) { return line.split(":")[1].strip_edges(); } } @@ -269,7 +269,7 @@ String OS_LinuxBSD::get_systemd_os_release_info_value(const String &key) const { if (f.is_valid()) { while (!f->eof_reached()) { const String line = f->get_line(); - if (line.find(key) != -1) { + if (line.contains(key)) { String value = line.split("=")[1].strip_edges(); value = value.trim_prefix("\""); return value.trim_suffix("\""); |