summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2013-12-09 04:52:21 (GMT)
committerJason Evans <jasone@canonware.com>2013-12-09 04:52:21 (GMT)
commit2a83ed0284e92c7ba4bd4efe9df149ac724b2f26 (patch)
tree915b5dbaa91c4a8dd3fdffedb98ce8abb48535b6 /src
parent9f35a71a81adcfd6c0ea6461ecd2b84ac384e34f (diff)
downloadjemalloc-2a83ed0284e92c7ba4bd4efe9df149ac724b2f26.zip
jemalloc-2a83ed0284e92c7ba4bd4efe9df149ac724b2f26.tar.gz
jemalloc-2a83ed0284e92c7ba4bd4efe9df149ac724b2f26.tar.bz2
Refactor tests.
Refactor tests to use explicit testing assertions, rather than diff'ing test output. This makes the test code a bit shorter, more explicitly encodes testing intent, and makes test failure diagnosis more straightforward.
Diffstat (limited to 'src')
-rw-r--r--src/chunk_mmap.c4
-rw-r--r--src/huge.c2
-rw-r--r--src/util.c6
3 files changed, 6 insertions, 6 deletions
diff --git a/src/chunk_mmap.c b/src/chunk_mmap.c
index 8a42e75..2056d79 100644
--- a/src/chunk_mmap.c
+++ b/src/chunk_mmap.c
@@ -43,7 +43,7 @@ pages_map(void *addr, size_t size)
if (munmap(ret, size) == -1) {
char buf[BUFERROR_BUF];
- buferror(buf, sizeof(buf));
+ buferror(get_errno(), buf, sizeof(buf));
malloc_printf("<jemalloc: Error in munmap(): %s\n",
buf);
if (opt_abort)
@@ -69,7 +69,7 @@ pages_unmap(void *addr, size_t size)
{
char buf[BUFERROR_BUF];
- buferror(buf, sizeof(buf));
+ buferror(get_errno(), buf, sizeof(buf));
malloc_printf("<jemalloc>: Error in "
#ifdef _WIN32
"VirtualFree"
diff --git a/src/huge.c b/src/huge.c
index aa08d43..443b400 100644
--- a/src/huge.c
+++ b/src/huge.c
@@ -169,7 +169,7 @@ huge_ralloc(void *ptr, size_t oldsize, size_t size, size_t extra,
*/
char buf[BUFERROR_BUF];
- buferror(buf, sizeof(buf));
+ buferror(get_errno(), buf, sizeof(buf));
malloc_printf("<jemalloc>: Error in mremap(): %s\n",
buf);
if (opt_abort)
diff --git a/src/util.c b/src/util.c
index 679fa76..d2ca4f2 100644
--- a/src/util.c
+++ b/src/util.c
@@ -77,7 +77,7 @@ malloc_write(const char *s)
* provide a wrapper.
*/
int
-buferror(char *buf, size_t buflen)
+buferror(int err, char *buf, size_t buflen)
{
#ifdef _WIN32
@@ -85,14 +85,14 @@ buferror(char *buf, size_t buflen)
(LPSTR)buf, buflen, NULL);
return (0);
#elif defined(_GNU_SOURCE)
- char *b = strerror_r(errno, buf, buflen);
+ char *b = strerror_r(err, buf, buflen);
if (b != buf) {
strncpy(buf, b, buflen);
buf[buflen-1] = '\0';
}
return (0);
#else
- return (strerror_r(errno, buf, buflen));
+ return (strerror_r(err, buf, buflen));
#endif
}