From 70bc623b58b334393fcb9e5700ea8b6a3f17ae27 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Fri, 22 Mar 2013 10:18:48 +0100 Subject: [PATCH] viralloc: Export virAllocTest* If users build with --enable-test-oom configure option, they get this error saying, virAllocTest* functions are not defined within tests/testutils.c. --- src/libvirt_private.syms | 4 ++++ src/util/viralloc.c | 24 ++++++++++++++++++++++++ src/util/viralloc.h | 7 ------- tests/testutils.c | 2 +- 4 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 9529265503..f241ec4e2f 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -993,6 +993,10 @@ virSecurityManagerVerify; # util/viralloc.h virAlloc; virAllocN; +virAllocTestCount; +virAllocTestHook; +virAllocTestInit; +virAllocTestOOM; virAllocVar; virDeleteElementsN; virExpandN; diff --git a/src/util/viralloc.c b/src/util/viralloc.c index 807de04f75..342b0eb4d8 100644 --- a/src/util/viralloc.c +++ b/src/util/viralloc.c @@ -74,6 +74,30 @@ static int virAllocTestFail(void) testMallocNext++; return fail; } + +#else + +void virAllocTestOOM(int n ATTRIBUTE_UNUSED, + int m ATTRIBUTE_UNUSED) +{ + /* nada */ +} + +int virAllocTestCount(void) +{ + return 0; +} + +void virAllocTestInit(void) +{ + /* nada */ +} + +void virAllocTestHook(void (*func)(int, void*) ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED) +{ + /* nada */ +} #endif diff --git a/src/util/viralloc.h b/src/util/viralloc.h index 6f46d0b4e1..7be7f82d57 100644 --- a/src/util/viralloc.h +++ b/src/util/viralloc.h @@ -376,15 +376,8 @@ void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1); # define VIR_FREE(ptr) virFree((void *) &(ptr)) # endif - - -# if TEST_OOM void virAllocTestInit(void); int virAllocTestCount(void); void virAllocTestOOM(int n, int m); void virAllocTestHook(void (*func)(int, void*), void *data); -# endif - - - #endif /* __VIR_MEMORY_H_ */ diff --git a/tests/testutils.c b/tests/testutils.c index ea46c095cb..0fb69ec928 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -697,7 +697,7 @@ int virtTestMain(int argc, if (worker) { _exit(ret); } else { - int i, status; + int i; for (i = 0 ; i < mp ; i++) { if (virProcessWait(workers[i], NULL) < 0) ret = EXIT_FAILURE; -- GitLab