Fixing checkpatch.pl warnings.
Most warnings are "Missing a blank line after declarations". I'm also
adding blank lines between multi-line comments and statements.
Ran with --ignore BRACES,SPDX_LICENSE_TAG,VOLATILE,SPLIT_STRING,
AVOID_EXTERNS,USE_SPINLOCK_T,NEW_TYPEDEFS,INITIALISED_STATIC,
FILE_PATH_CHANGES to reduce noise. Now there is only one type of
warning, with two instances:
WARNING: Prefer using '"%s...", __func__' to using 'dmb', this function's name, in a string
+ __asm__ volatile("dmb sy");
WARNING: Prefer using '"%s...", __func__' to using 'dsb', this function's name, in a string
+ __asm__ volatile("dsb sy");
Change-Id: Id837feef86dc81ba84de1809e76653ddce814422
diff --git a/src/memiter.c b/src/memiter.c
index ad98fac..8b9854c 100644
--- a/src/memiter.c
+++ b/src/memiter.c
@@ -59,9 +59,11 @@
bool memiter_iseq(const struct memiter *it, const char *str)
{
size_t len = strlen(str);
+
if (len != it->limit - it->next) {
return false;
}
+
return memcmp(it->next, str, len) == 0;
}
@@ -126,9 +128,12 @@
bool memiter_advance(struct memiter *it, size_t v)
{
const char *p = it->next + v;
+
if (p < it->next || p > it->limit) {
return false;
}
+
it->next = p;
+
return true;
}