aboutsummaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-05-21 11:05:38 +0100
committergingerBill <bill@gingerbill.org>2020-05-21 11:05:38 +0100
commit0b16ed7c85f2474b8893b93f854d9e2bd0aeb43d (patch)
tree7556a38f2f563342c5faa591a694ae5c90af6a7d /src/string.cpp
parent89d824216a80285445d08e85b6650897a12d33cb (diff)
Use `memcmp` for `str_eq`
Diffstat (limited to 'src/string.cpp')
-rw-r--r--src/string.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/string.cpp b/src/string.cpp
index 724733ce7..dfcbe4854 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -170,12 +170,7 @@ GB_COMPARE_PROC(string_cmp_proc) {
gb_inline bool str_eq(String const &a, String const &b) {
if (a.len != b.len) return false;
- for (isize i = 0; i < a.len; i++) {
- if (a.text[i] != b.text[i]) {
- return false;
- }
- }
- return true;
+ return memcmp(a.text, b.text, a.len) == 0;
}
gb_inline bool str_ne(String const &a, String const &b) { return !str_eq(a, b); }
gb_inline bool str_lt(String const &a, String const &b) { return string_compare(a, b) < 0; }