diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-10-17 12:07:39 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-10-17 12:07:39 +0200 |
commit | 39fa1eb2c272671b09f3e9d6a5c9afb11a1ebee3 (patch) | |
tree | 21269fce78156239986f43ed89ce15495aa9539c /Kernel/StdLib.cpp | |
parent | 705832f3873c335eae38917fcca2e48bbb8e3354 (diff) | |
download | serenity-39fa1eb2c272671b09f3e9d6a5c9afb11a1ebee3.zip |
Print the contents of motd.txt on boot.
Diffstat (limited to 'Kernel/StdLib.cpp')
-rw-r--r-- | Kernel/StdLib.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Kernel/StdLib.cpp b/Kernel/StdLib.cpp index 1ecdc6c9af..4c4794ba7b 100644 --- a/Kernel/StdLib.cpp +++ b/Kernel/StdLib.cpp @@ -1,6 +1,7 @@ #include "types.h" #include "Assertions.h" #include "kmalloc.h" +#include <AK/Types.h> void memcpy(void *dest, const void *src, DWORD n) { @@ -51,11 +52,13 @@ char* strdup(const char *str) int memcmp(const void* v1, const void* v2, size_t n) { - size_t m; - const char* s1 = (const char*)v1; - const char* s2 = (const char*)v2; - for (m = 0; m < n && *s1 == *s2; ++s1, ++s2); - return m == n ? 0 : -1; + auto* s1 = (const byte*)v1; + auto* s2 = (const byte*)v2; + while (n-- > 0) { + if (*s1++ != *s2++) + return s1[-1] < s2[-1] ? -1 : 1; + } + return 0; } extern "C" void __cxa_pure_virtual() |