fix(libc): add missing curly braces
This corrects the MISRA violation C2012-15.6:
The body of an iteration-statement or a selection-statement shall
be a compound-statement.
Enclosed statement body within the curly braces.
In spite of generic guidance for 3rd party libraries
(https://trustedfirmware-a.readthedocs.io/en/latest/process/coding-style.html#misra-compliance)
libc contains some MISRA-C fixes done by commit d5ccb754af86
("libc: Fix some MISRA defects") in 2021.
Also from history it is not clear where libc is
coming from that's why there is no way to fix
violation in base library.
Change-Id: I9007cfc8019e885cd294dbbd68e6b3f65a6071ba
Signed-off-by: Nithin G <nithing@amd.com>
Signed-off-by: Maheedhar Bollapalli <maheedharsai.bollapalli@amd.com>
diff --git a/lib/libc/memmove.c b/lib/libc/memmove.c
index 5c2b661..023420d 100644
--- a/lib/libc/memmove.c
+++ b/lib/libc/memmove.c
@@ -24,8 +24,9 @@
const char *end = dst;
const char *s = (const char *)src + len;
char *d = (char *)dst + len;
- while (d != end)
+ while (d != end) {
*--d = *--s;
+ }
}
return dst;
}