diff options
author | Luca Muscariello <lumuscar+fdio@cisco.com> | 2019-01-24 16:32:25 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2019-01-24 16:32:25 +0000 |
commit | 9fc2b9ec49c54ec2d5f0164bbedc1c78732c464c (patch) | |
tree | c7ebcf4c83b5c2f71318bc69c6f6915aaac7ae2a /libparc/parc/concurrent | |
parent | cada1143501a48effc483e3873596c22849926b5 (diff) | |
parent | 097e69e6daeefc84fd271babbdc1b47dfe4c01e5 (diff) |
Merge "Add support for ubuntu18.04 packages."
Diffstat (limited to 'libparc/parc/concurrent')
19 files changed, 61 insertions, 46 deletions
diff --git a/libparc/parc/concurrent/parc_AtomicUint16.c b/libparc/parc/concurrent/parc_AtomicUint16.c index 24c9f922..9bf2e478 100755 --- a/libparc/parc/concurrent/parc_AtomicUint16.c +++ b/libparc/parc/concurrent/parc_AtomicUint16.c @@ -32,7 +32,7 @@ struct PARCAtomicUint16 { static void _parcAtomicUint16_Finalize(PARCAtomicUint16 **instancePtr) { - assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint16 pointer."); + parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint16 pointer."); parcAtomicUint16_OptionalAssertValid((*instancePtr)); @@ -49,7 +49,7 @@ parcObject_ExtendPARCObject(PARCAtomicUint16, _parcAtomicUint16_Finalize, parcAt void parcAtomicUint16_AssertValid(const PARCAtomicUint16 *instance) { - assertTrue(parcAtomicUint16_IsValid(instance), + parcAssertTrue(parcAtomicUint16_IsValid(instance), "PARCAtomicUint16 is not valid."); } diff --git a/libparc/parc/concurrent/parc_AtomicUint32.c b/libparc/parc/concurrent/parc_AtomicUint32.c index 32ed7a6a..24093951 100755 --- a/libparc/parc/concurrent/parc_AtomicUint32.c +++ b/libparc/parc/concurrent/parc_AtomicUint32.c @@ -32,7 +32,7 @@ struct PARCAtomicUint32 { static void _parcAtomicUint32_Finalize(PARCAtomicUint32 **instancePtr) { - assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint32 pointer."); + parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint32 pointer."); parcAtomicUint32_OptionalAssertValid((*instancePtr)); @@ -49,7 +49,7 @@ parcObject_ExtendPARCObject(PARCAtomicUint32, _parcAtomicUint32_Finalize, parcAt void parcAtomicUint32_AssertValid(const PARCAtomicUint32 *instance) { - assertTrue(parcAtomicUint32_IsValid(instance), + parcAssertTrue(parcAtomicUint32_IsValid(instance), "PARCAtomicUint32 is not valid."); } diff --git a/libparc/parc/concurrent/parc_AtomicUint64.c b/libparc/parc/concurrent/parc_AtomicUint64.c index 35d5cf66..326f39db 100755 --- a/libparc/parc/concurrent/parc_AtomicUint64.c +++ b/libparc/parc/concurrent/parc_AtomicUint64.c @@ -32,7 +32,7 @@ struct PARCAtomicUint64 { static void _parcAtomicUint64_Finalize(PARCAtomicUint64 **instancePtr) { - assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint64 pointer."); + parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint64 pointer."); parcAtomicUint64_OptionalAssertValid((*instancePtr)); @@ -49,7 +49,7 @@ parcObject_ExtendPARCObject(PARCAtomicUint64, _parcAtomicUint64_Finalize, parcAt void parcAtomicUint64_AssertValid(const PARCAtomicUint64 *instance) { - assertTrue(parcAtomicUint64_IsValid(instance), + parcAssertTrue(parcAtomicUint64_IsValid(instance), "PARCAtomicUint64 is not valid."); } diff --git a/libparc/parc/concurrent/parc_AtomicUint8.c b/libparc/parc/concurrent/parc_AtomicUint8.c index 59a3d865..fd34258b 100755 --- a/libparc/parc/concurrent/parc_AtomicUint8.c +++ b/libparc/parc/concurrent/parc_AtomicUint8.c @@ -32,7 +32,7 @@ struct PARCAtomicUint8 { static void _parcAtomicUint8_Finalize(PARCAtomicUint8 **instancePtr) { - assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint8 pointer."); + parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCAtomicUint8 pointer."); parcAtomicUint8_OptionalAssertValid((*instancePtr)); @@ -49,7 +49,7 @@ parcObject_ExtendPARCObject(PARCAtomicUint8, _parcAtomicUint8_Finalize, parcAtom void parcAtomicUint8_AssertValid(const PARCAtomicUint8 *instance) { - assertTrue(parcAtomicUint8_IsValid(instance), + parcAssertTrue(parcAtomicUint8_IsValid(instance), "PARCAtomicUint8 is not valid."); } diff --git a/libparc/parc/concurrent/parc_FutureTask.c b/libparc/parc/concurrent/parc_FutureTask.c index 0ba2c224..d323e0bd 100755 --- a/libparc/parc/concurrent/parc_FutureTask.c +++ b/libparc/parc/concurrent/parc_FutureTask.c @@ -46,7 +46,7 @@ _parcFutureTask_Initialise(PARCFutureTask *futureTask) static bool _parcFutureTask_Destructor(PARCFutureTask **instancePtr) { - assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCFutureTask pointer."); + parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCFutureTask pointer."); PARCFutureTask *task = *instancePtr; if (parcObject_IsInstanceOf(task->parameter, &PARCObject_Descriptor)) { @@ -73,7 +73,7 @@ parcObject_Override(PARCFutureTask, PARCObject, void parcFutureTask_AssertValid(const PARCFutureTask *task) { - assertTrue(parcFutureTask_IsValid(task), + parcAssertTrue(parcFutureTask_IsValid(task), "PARCFutureTask is not valid."); } @@ -273,7 +273,7 @@ parcFutureTask_Run(PARCFutureTask *task) } parcFutureTask_Unlock(task); } else { - trapCannotObtainLock("Cannot lock PARCFutureTask"); + parcTrapCannotObtainLock("Cannot lock PARCFutureTask"); } return task->result; } @@ -291,7 +291,7 @@ parcFutureTask_RunAndReset(PARCFutureTask *task) } parcFutureTask_Unlock(task); } else { - trapCannotObtainLock("Cannot lock PARCFutureTask"); + parcTrapCannotObtainLock("Cannot lock PARCFutureTask"); } return result; diff --git a/libparc/parc/concurrent/parc_Lock.c b/libparc/parc/concurrent/parc_Lock.c index d510b5ed..493fd44f 100755 --- a/libparc/parc/concurrent/parc_Lock.c +++ b/libparc/parc/concurrent/parc_Lock.c @@ -37,7 +37,7 @@ struct PARCLock { static void _parcLock_Finalize(PARCLock **instancePtr) { - assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCLock pointer."); + parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCLock pointer."); parcLock_OptionalAssertValid(*instancePtr); @@ -53,7 +53,7 @@ parcObject_ExtendPARCObject(PARCLock, _parcLock_Finalize, NULL, parcLock_ToStrin void parcLock_AssertValid(const PARCLock *instance) { - assertTrue(parcLock_IsValid(instance), + parcAssertTrue(parcLock_IsValid(instance), "PARCLock is not valid."); } @@ -179,7 +179,7 @@ parcLock_Wait(PARCLock *lock) { parcLock_OptionalAssertValid(lock); - trapUnexpectedStateIf(lock->locked == false, + parcTrapUnexpectedStateIf(lock->locked == false, "You must Lock the object before calling parcLock_Wait"); lock->notified = false; @@ -193,7 +193,7 @@ parcLock_Notify(PARCLock *lock) { parcLock_OptionalAssertValid(lock); - trapUnexpectedStateIf(lock->locked == false, + parcTrapUnexpectedStateIf(lock->locked == false, "You must Lock the object before calling parcLock_Notify"); lock->notified = true; diff --git a/libparc/parc/concurrent/parc_Notifier.c b/libparc/parc/concurrent/parc_Notifier.c index 6cba9147..67e8cfb3 100755 --- a/libparc/parc/concurrent/parc_Notifier.c +++ b/libparc/parc/concurrent/parc_Notifier.c @@ -23,7 +23,7 @@ #include <errno.h> #include <fcntl.h> -#include <LongBow/runtime.h> +#include <parc/assert/parc_Assert.h> #include <parc/concurrent/parc_Notifier.h> #include <parc/algol/parc_Object.h> @@ -83,7 +83,7 @@ parcNotifier_Create(void) notifier->skippedNotify = false; int failure = pipe(notifier->fds); - assertFalse(failure, "Error on pipe: %s", strerror(errno)); + parcAssertFalse(failure, "Error on pipe: %s", strerror(errno)); if (!_parcNotifier_MakeNonblocking(notifier)) { parcObject_Release((void **) ¬ifier); @@ -113,7 +113,7 @@ parcNotifier_Notify(PARCNotifier *notifier) ssize_t written; do { written = write(notifier->fds[PARCNotifierWriteFd], &one, 1); - assertTrue(written >= 0, "Error writing to socket %d: %s", notifier->fds[PARCNotifierWriteFd], strerror(errno)); + parcAssertTrue(written >= 0, "Error writing to socket %d: %s", notifier->fds[PARCNotifierWriteFd], strerror(errno)); } while (written == 0); return true; diff --git a/libparc/parc/concurrent/parc_RingBuffer.c b/libparc/parc/concurrent/parc_RingBuffer.c index 9492ae92..d5fb677b 100755 --- a/libparc/parc/concurrent/parc_RingBuffer.c +++ b/libparc/parc/concurrent/parc_RingBuffer.c @@ -27,7 +27,7 @@ #include <parc/algol/parc_Memory.h> #include <parc/algol/parc_Object.h> -#include <LongBow/runtime.h> +#include <parc/assert/parc_Assert.h> #include <parc/concurrent/parc_RingBuffer.h> diff --git a/libparc/parc/concurrent/parc_RingBuffer_1x1.c b/libparc/parc/concurrent/parc_RingBuffer_1x1.c index a023f4d7..a93049eb 100755 --- a/libparc/parc/concurrent/parc_RingBuffer_1x1.c +++ b/libparc/parc/concurrent/parc_RingBuffer_1x1.c @@ -81,7 +81,7 @@ #include <parc/algol/parc_Memory.h> #include <parc/algol/parc_Object.h> -#include <LongBow/runtime.h> +#include <parc/assert/parc_Assert.h> #include <parc/concurrent/parc_RingBuffer_1x1.h> @@ -141,10 +141,10 @@ static PARCRingBuffer1x1 * _create(uint32_t elements, RingBufferEntryDestroyer *destroyer) { PARCRingBuffer1x1 *ring = parcObject_CreateInstance(PARCRingBuffer1x1); - assertNotNull(ring, "parcObject_Create returned NULL"); + parcAssertNotNull(ring, "parcObject_Create returned NULL"); ring->buffer = parcMemory_AllocateAndClear(sizeof(void *) * elements); - assertNotNull((ring->buffer), "parcMemory_AllocateAndClear() failed to allocate array of %u pointers", elements); + parcAssertNotNull((ring->buffer), "parcMemory_AllocateAndClear() failed to allocate array of %u pointers", elements); ring->writer_head = 0; ring->reader_tail = 0; @@ -158,7 +158,7 @@ _create(uint32_t elements, RingBufferEntryDestroyer *destroyer) PARCRingBuffer1x1 * parcRingBuffer1x1_Create(uint32_t elements, RingBufferEntryDestroyer *destroyer) { - assertTrue(_isPowerOfTwo(elements), "Parameter elements must be a power of 2, got %u", elements); + parcAssertTrue(_isPowerOfTwo(elements), "Parameter elements must be a power of 2, got %u", elements); return _create(elements, destroyer); } @@ -189,7 +189,7 @@ parcRingBuffer1x1_Put(PARCRingBuffer1x1 *ring, void *data) return false; } - assertNull(ring->buffer[writer_head], "Ring index %u is not null!", writer_head); + parcAssertNull(ring->buffer[writer_head], "Ring index %u is not null!", writer_head); ring->buffer[writer_head] = data; // we're using this just for atomic write to the integer diff --git a/libparc/parc/concurrent/parc_RingBuffer_NxM.c b/libparc/parc/concurrent/parc_RingBuffer_NxM.c index 15ec849b..4ea69e58 100755 --- a/libparc/parc/concurrent/parc_RingBuffer_NxM.c +++ b/libparc/parc/concurrent/parc_RingBuffer_NxM.c @@ -29,7 +29,7 @@ #include <parc/algol/parc_Memory.h> #include <parc/algol/parc_Object.h> -#include <LongBow/runtime.h> +#include <parc/assert/parc_Assert.h> #include <parc/concurrent/parc_RingBuffer_1x1.h> #include <parc/concurrent/parc_RingBuffer_NxM.h> @@ -55,7 +55,7 @@ static bool _lock(pthread_mutex_t *mutex) { int failure = pthread_mutex_lock(mutex); - assertFalse(failure, "Error locking mutex: (%d) %s\n", errno, strerror(errno)); + parcAssertFalse(failure, "Error locking mutex: (%d) %s\n", errno, strerror(errno)); return true; } @@ -63,7 +63,7 @@ static bool _unlock(pthread_mutex_t *mutex) { int failure = pthread_mutex_unlock(mutex); - assertFalse(failure, "Error unlocking mutex: (%d) %s\n", errno, strerror(errno)); + parcAssertFalse(failure, "Error unlocking mutex: (%d) %s\n", errno, strerror(errno)); return true; } @@ -88,7 +88,7 @@ static PARCRingBufferNxM * _create(uint32_t elements, RingBufferEntryDestroyer *destroyer) { PARCRingBufferNxM *ring = parcObject_CreateInstance(PARCRingBufferNxM); - assertNotNull(ring, "parcObject_Create returned NULL"); + parcAssertNotNull(ring, "parcObject_Create returned NULL"); ring->onebyone = parcRingBuffer1x1_Create(elements, destroyer); ring->destroyer = destroyer; diff --git a/libparc/parc/concurrent/parc_ScheduledTask.c b/libparc/parc/concurrent/parc_ScheduledTask.c index 14c1d556..4875abf7 100755 --- a/libparc/parc/concurrent/parc_ScheduledTask.c +++ b/libparc/parc/concurrent/parc_ScheduledTask.c @@ -35,7 +35,7 @@ struct PARCScheduledTask { static bool _parcScheduledTask_Destructor(PARCScheduledTask **instancePtr) { - assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCScheduledTask pointer."); + parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCScheduledTask pointer."); PARCScheduledTask *task = *instancePtr; parcFutureTask_Release(&task->task); @@ -59,7 +59,7 @@ parcObject_Override(PARCScheduledTask, PARCObject, void parcScheduledTask_AssertValid(const PARCScheduledTask *instance) { - assertTrue(parcScheduledTask_IsValid(instance), + parcAssertTrue(parcScheduledTask_IsValid(instance), "PARCScheduledTask is not valid."); } diff --git a/libparc/parc/concurrent/parc_ScheduledThreadPool.c b/libparc/parc/concurrent/parc_ScheduledThreadPool.c index 3d6c3e57..0b77372e 100644 --- a/libparc/parc/concurrent/parc_ScheduledThreadPool.c +++ b/libparc/parc/concurrent/parc_ScheduledThreadPool.c @@ -72,7 +72,7 @@ _workerThread(PARCThread *thread, PARCScheduledThreadPool *pool) static bool _parcScheduledThreadPool_Destructor(PARCScheduledThreadPool **instancePtr) { - assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCScheduledThreadPool pointer."); + parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCScheduledThreadPool pointer."); PARCScheduledThreadPool *pool = *instancePtr; parcThreadPool_Release(&pool->threadPool); @@ -81,7 +81,7 @@ _parcScheduledThreadPool_Destructor(PARCScheduledThreadPool **instancePtr) if (parcObject_Lock(pool->workQueue)) { parcSortedList_Release(&pool->workQueue); } else { - assertTrue(false, "Cannot lock the work queue."); + parcAssertTrue(false, "Cannot lock the work queue."); } return true; @@ -103,7 +103,7 @@ parcObject_Override(PARCScheduledThreadPool, PARCObject, void parcScheduledThreadPool_AssertValid(const PARCScheduledThreadPool *instance) { - assertTrue(parcScheduledThreadPool_IsValid(instance), + parcAssertTrue(parcScheduledThreadPool_IsValid(instance), "PARCScheduledThreadPool is not valid."); } diff --git a/libparc/parc/concurrent/parc_Synchronizer.c b/libparc/parc/concurrent/parc_Synchronizer.c index c4475476..ab331442 100755 --- a/libparc/parc/concurrent/parc_Synchronizer.c +++ b/libparc/parc/concurrent/parc_Synchronizer.c @@ -44,7 +44,7 @@ struct PARCSynchronizer { static void _parcSynchronizer_Finalize(PARCSynchronizer **instancePtr) { - assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSynchronizer pointer."); + parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCSynchronizer pointer."); parcSynchronizer_OptionalAssertValid((*instancePtr)); } @@ -58,7 +58,7 @@ parcObject_ExtendPARCObject(PARCSynchronizer, _parcSynchronizer_Finalize, NULL, void parcSynchronizer_AssertValid(const PARCSynchronizer *instance) { - assertTrue(parcSynchronizer_IsValid(instance), + parcAssertTrue(parcSynchronizer_IsValid(instance), "PARCSynchronizer is not valid."); } diff --git a/libparc/parc/concurrent/parc_Thread.c b/libparc/parc/concurrent/parc_Thread.c index 4bccc47f..50be042d 100644 --- a/libparc/parc/concurrent/parc_Thread.c +++ b/libparc/parc/concurrent/parc_Thread.c @@ -36,7 +36,7 @@ struct PARCThread { static bool _parcThread_Destructor(PARCThread **instancePtr) { - assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCThread pointer."); + parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCThread pointer."); PARCThread *thread = *instancePtr; if (thread->argument != NULL) { @@ -67,14 +67,14 @@ parcObject_Override(PARCThread, PARCObject, void parcThread_AssertValid(const PARCThread *instance) { - assertTrue(parcThread_IsValid(instance), + parcAssertTrue(parcThread_IsValid(instance), "PARCThread is not valid."); } PARCThread * parcThread_Create(void *(*runFunction)(PARCThread *, PARCObject *), PARCObject *restrict parameter) { - assertNotNull(parameter, "Parameter cannot be NULL."); + parcAssertNotNull(parameter, "Parameter cannot be NULL."); PARCThread *result = parcObject_CreateAndClearInstance(PARCThread); diff --git a/libparc/parc/concurrent/parc_ThreadPool.c b/libparc/parc/concurrent/parc_ThreadPool.c index 80b093ba..2d9ef6d6 100644 --- a/libparc/parc/concurrent/parc_ThreadPool.c +++ b/libparc/parc/concurrent/parc_ThreadPool.c @@ -96,7 +96,7 @@ _parcThreadPool_JoinAll(const PARCThreadPool *pool) static bool _parcThreadPool_Destructor(PARCThreadPool **instancePtr) { - assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCThreadPool pointer."); + parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCThreadPool pointer."); PARCThreadPool *pool = *instancePtr; if (pool->isShutdown == false) { @@ -130,7 +130,7 @@ parcObject_Override(PARCThreadPool, PARCObject, void parcThreadPool_AssertValid(const PARCThreadPool *instance) { - assertTrue(parcThreadPool_IsValid(instance), + parcAssertTrue(parcThreadPool_IsValid(instance), "PARCThreadPool is not valid."); } diff --git a/libparc/parc/concurrent/parc_Timer.c b/libparc/parc/concurrent/parc_Timer.c index e6d84de4..b1ecb5d2 100755 --- a/libparc/parc/concurrent/parc_Timer.c +++ b/libparc/parc/concurrent/parc_Timer.c @@ -30,7 +30,7 @@ struct PARCTimer { static void _parcTimer_Finalize(PARCTimer **instancePtr) { - assertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCTimer pointer."); + parcAssertNotNull(instancePtr, "Parameter must be a non-null pointer to a PARCTimer pointer."); /* cleanup the instance fields here */ @@ -46,7 +46,7 @@ parcObject_ExtendPARCObject(PARCTimer, _parcTimer_Finalize, parcTimer_Copy, parc void parcTimer_AssertValid(const PARCTimer *instance) { - assertTrue(parcTimer_IsValid(instance), + parcAssertTrue(parcTimer_IsValid(instance), "PARCTimer is not valid."); } diff --git a/libparc/parc/concurrent/test/test_parc_ScheduledThreadPool.c b/libparc/parc/concurrent/test/test_parc_ScheduledThreadPool.c index f466d72a..e2e2473c 100644 --- a/libparc/parc/concurrent/test/test_parc_ScheduledThreadPool.c +++ b/libparc/parc/concurrent/test/test_parc_ScheduledThreadPool.c @@ -80,7 +80,7 @@ LONGBOW_TEST_CASE(CreateAcquireRelease, CreateRelease) parcObjectTesting_AssertAcquireReleaseContract(parcScheduledThreadPool_Acquire, instance); parcScheduledThreadPool_ShutdownNow(instance); - assertTrue(parcObject_GetReferenceCount(instance) == 1, "Expected 1 reference count. Actual %llu", parcObject_GetReferenceCount(instance)); + assertTrue(parcObject_GetReferenceCount(instance) == 1, "Expected 1 reference count. Actual %lu", parcObject_GetReferenceCount(instance)); parcScheduledThreadPool_Release(&instance); assertNull(instance, "Expected null result from parcScheduledThreadPool_Release();"); @@ -260,7 +260,7 @@ LONGBOW_TEST_CASE(Specialization, OneJob) PARCFutureTask *task = parcFutureTask_Create(_function, _function); parcScheduledThreadPool_Schedule(pool, task, parcTimeout_MilliSeconds(2000)); - printf("references %lld\n", parcObject_GetReferenceCount(task)); + printf("references %lu\n", parcObject_GetReferenceCount(task)); parcFutureTask_Release(&task); sleep(5); diff --git a/libparc/parc/concurrent/test/test_parc_Thread.c b/libparc/parc/concurrent/test/test_parc_Thread.c index 22ca31bf..679f58d0 100644 --- a/libparc/parc/concurrent/test/test_parc_Thread.c +++ b/libparc/parc/concurrent/test/test_parc_Thread.c @@ -72,7 +72,12 @@ LONGBOW_TEST_FIXTURE_TEARDOWN(CreateAcquireRelease) PARCBuffer *buffer = longBowTestCase_Get(testCase, "object"); parcBuffer_Release(&buffer); +#if INTPTR_MAX == INT32_MAX uint32_t initialAllocations = (uint32_t) longBowTestCase_Get(testCase, "initialAllocations"); +#else + uint64_t initialAllocations = (uint64_t) longBowTestCase_Get(testCase, "initialAllocations"); +#endif + if (!parcMemoryTesting_ExpectedOutstanding(initialAllocations, "%s leaked memory.", longBowTestCase_GetFullName(testCase))) { parcSafeMemory_ReportAllocation(1); return LONGBOW_STATUS_MEMORYLEAK; @@ -126,7 +131,12 @@ LONGBOW_TEST_FIXTURE_TEARDOWN(Object) PARCBuffer *buffer = longBowTestCase_Get(testCase, "object"); parcBuffer_Release(&buffer); +#if INTPTR_MAX == INT32_MAX uint32_t initialAllocations = (uint32_t) longBowTestCase_Get(testCase, "initialAllocations"); +#else + uint64_t initialAllocations = (uint64_t) longBowTestCase_Get(testCase, "initialAllocations"); +#endif + if (!parcMemoryTesting_ExpectedOutstanding(initialAllocations, "%s leaked memory.", longBowTestCase_GetFullName(testCase))) { parcSafeMemory_ReportAllocation(1); return LONGBOW_STATUS_MEMORYLEAK; @@ -239,7 +249,12 @@ LONGBOW_TEST_FIXTURE_SETUP(Specialization) LONGBOW_TEST_FIXTURE_TEARDOWN(Specialization) { +#if INTPTR_MAX == INT32_MAX uint32_t initialAllocations = (uint32_t) longBowTestCase_Get(testCase, "initialAllocations"); +#else + uint64_t initialAllocations = (uint64_t) longBowTestCase_Get(testCase, "initialAllocations"); +#endif + if (!parcMemoryTesting_ExpectedOutstanding(initialAllocations, "%s leaked memory.", longBowTestCase_GetFullName(testCase))) { parcSafeMemory_ReportAllocation(1); return LONGBOW_STATUS_MEMORYLEAK; diff --git a/libparc/parc/concurrent/test/test_parc_ThreadPool.c b/libparc/parc/concurrent/test/test_parc_ThreadPool.c index 6ed6e4d3..5ec60fa5 100644 --- a/libparc/parc/concurrent/test/test_parc_ThreadPool.c +++ b/libparc/parc/concurrent/test/test_parc_ThreadPool.c @@ -255,7 +255,7 @@ LONGBOW_TEST_CASE(Object, parcThreadPool_Execute) assertTrue(shutdownSuccess, "parcThreadPool_AwaitTermination timed-out"); uint64_t count = parcThreadPool_GetCompletedTaskCount(pool); - assertTrue(count == 5, "Expected 5, actual %lld", count); + assertTrue(count == 5, "Expected 5, actual %lu", count); parcThreadPool_Release(&pool); |