summaryrefslogtreecommitdiff
path: root/minion/src/util.cpp
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2022-05-30 13:11:38 +0200
committerHampusM <hampus@hampusmat.com>2022-05-30 13:11:38 +0200
commitec20c707ea677c9b2c8e585b78c9837a2f6e7372 (patch)
tree6499124c7f7cd1d3da12afb60ab9f65f7782d228 /minion/src/util.cpp
parentd95ce9a08977b82fe6f331f110c218044b9f41cb (diff)
refactor(minion): make reading wifi module more reliable
Diffstat (limited to 'minion/src/util.cpp')
-rw-r--r--minion/src/util.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/minion/src/util.cpp b/minion/src/util.cpp
index 15cf840..708e47d 100644
--- a/minion/src/util.cpp
+++ b/minion/src/util.cpp
@@ -3,22 +3,22 @@
namespace util
{
-auto str_ends_with(const char *str, const char *other_str) noexcept -> bool
+auto str_ends_with(const char *target, size_t target_end, const char *other) noexcept
+ -> bool
{
- if (str == nullptr || other_str == nullptr)
+ if (target == nullptr || other == nullptr)
{
return false;
}
- auto str_length = strlen(str);
- auto other_str_length = strlen(other_str);
+ const auto other_str_length = strlen(other);
- if (other_str_length > str_length)
+ if (other_str_length > target_end)
{
return false;
}
- return strncmp(str + str_length - other_str_length, other_str, other_str_length) == 0;
+ return strncmp(target + target_end - other_str_length, other, other_str_length) == 0;
}
void substr(const char *str, const char *end, char *dest) noexcept