... to make its behavior the same as C standard (e.g., C99 and C11).
Signed-off-by: Haozhong Zhang <[email protected]>
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
---
tools/firmware/hvmloader/util.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index 0c3f2d24cd..76a61ee052 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -141,9 +141,16 @@ int strcmp(const char *cs, const char *ct)
int strncmp(const char *s1, const char *s2, uint32_t n)
{
uint32_t ctr;
+
for (ctr = 0; ctr < n; ctr++)
+ {
if (s1[ctr] != s2[ctr])
return (int)(s1[ctr] - s2[ctr]);
+
+ if (!s1[ctr])
+ break;
+ }
+
return 0;
}
--
2.15.1
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel