diff options
author | Bruce Beare <brucex.j.beare@intel.com> | 2010-03-04 11:08:04 -0800 |
---|---|---|
committer | Bruce Beare <brucex.j.beare@intel.com> | 2010-03-04 11:08:04 -0800 |
commit | 48b40fefa1cd8b5371cb468dfcd79369a137566f (patch) | |
tree | 9e56a8dcbc96d2aab4ca968ad1a105312ed08f57 | |
parent | fa2de09c65fc50379eaffb22e71fb4b0474a3e22 (diff) | |
download | extras-48b40fefa1cd8b5371cb468dfcd79369a137566f.tar.gz |
Make memtest conform to POSIX memcmp defn
-rw-r--r-- | tests/memtest/memtest.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/memtest/memtest.cpp b/tests/memtest/memtest.cpp index 610421e6..8bdfb4f0 100644 --- a/tests/memtest/memtest.cpp +++ b/tests/memtest/memtest.cpp @@ -381,7 +381,7 @@ static int ref_memcmp(const void *s1, const void *s2, size_t n) break; } - return d; + return (d < 0 ? -1 : (d > 0 ? 1 : 0)); } int validate_memcmp(const char* s, const char* d, size_t size) @@ -389,6 +389,7 @@ int validate_memcmp(const char* s, const char* d, size_t size) int a = ref_memcmp(s, d, size); int b = memcmp(s, d, size); + b = (b < 0 ? -1 : (b > 0 ? 1 : 0)); //printf("%d, %d\n", a, b); if (a != b) { printf("*** memcmp(%p,%p,%lu) failed %d should be %d\n",s,d,size,b,a); |