mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-09 20:24:14 +00:00
[common] all: switch asserts to DEBUG_ASSERT
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdatomic.h>
|
||||
#include <stdint.h>
|
||||
@@ -78,7 +77,7 @@ LGEvent * lgCreateEvent(bool autoReset, unsigned int msSpinTime)
|
||||
|
||||
void lgFreeEvent(LGEvent * handle)
|
||||
{
|
||||
assert(handle);
|
||||
DEBUG_ASSERT(handle);
|
||||
|
||||
if (atomic_load_explicit(&handle->waiting, memory_order_acquire) != 0)
|
||||
DEBUG_ERROR("BUG: Freeing an event that still has threads waiting on it");
|
||||
@@ -90,7 +89,7 @@ void lgFreeEvent(LGEvent * handle)
|
||||
|
||||
bool lgWaitEventAbs(LGEvent * handle, struct timespec * ts)
|
||||
{
|
||||
assert(handle);
|
||||
DEBUG_ASSERT(handle);
|
||||
|
||||
bool ret = true;
|
||||
int res;
|
||||
@@ -173,7 +172,7 @@ bool lgWaitEvent(LGEvent * handle, unsigned int timeout)
|
||||
|
||||
bool lgSignalEvent(LGEvent * handle)
|
||||
{
|
||||
assert(handle);
|
||||
DEBUG_ASSERT(handle);
|
||||
|
||||
if (pthread_mutex_lock(&handle->mutex) != 0)
|
||||
{
|
||||
@@ -202,6 +201,6 @@ bool lgSignalEvent(LGEvent * handle)
|
||||
|
||||
bool lgResetEvent(LGEvent * handle)
|
||||
{
|
||||
assert(handle);
|
||||
DEBUG_ASSERT(handle);
|
||||
return atomic_exchange_explicit(&handle->signaled, false, memory_order_release);
|
||||
}
|
||||
|
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "common/ivshmem.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
@@ -118,7 +117,7 @@ bool ivshmemOpen(struct IVSHMEM * dev)
|
||||
|
||||
bool ivshmemOpenDev(struct IVSHMEM * dev, const char * shmDevice)
|
||||
{
|
||||
assert(dev);
|
||||
DEBUG_ASSERT(dev);
|
||||
|
||||
unsigned int devSize;
|
||||
int devFd = -1;
|
||||
@@ -186,7 +185,7 @@ bool ivshmemOpenDev(struct IVSHMEM * dev, const char * shmDevice)
|
||||
|
||||
void ivshmemClose(struct IVSHMEM * dev)
|
||||
{
|
||||
assert(dev);
|
||||
DEBUG_ASSERT(dev);
|
||||
|
||||
if (!dev->opaque)
|
||||
return;
|
||||
@@ -210,7 +209,7 @@ void ivshmemFree(struct IVSHMEM * dev)
|
||||
|
||||
bool ivshmemHasDMA(struct IVSHMEM * dev)
|
||||
{
|
||||
assert(dev && dev->opaque);
|
||||
DEBUG_ASSERT(dev && dev->opaque);
|
||||
|
||||
struct IVSHMEMInfo * info =
|
||||
(struct IVSHMEMInfo *)dev->opaque;
|
||||
@@ -220,9 +219,9 @@ bool ivshmemHasDMA(struct IVSHMEM * dev)
|
||||
|
||||
int ivshmemGetDMABuf(struct IVSHMEM * dev, uint64_t offset, uint64_t size)
|
||||
{
|
||||
assert(ivshmemHasDMA(dev));
|
||||
assert(dev && dev->opaque);
|
||||
assert(offset + size <= dev->size);
|
||||
DEBUG_ASSERT(ivshmemHasDMA(dev));
|
||||
DEBUG_ASSERT(dev && dev->opaque);
|
||||
DEBUG_ASSERT(offset + size <= dev->size);
|
||||
|
||||
static long pageSize = 0;
|
||||
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include <windows.h>
|
||||
#include "ivshmem.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <setupapi.h>
|
||||
#include <io.h>
|
||||
|
||||
@@ -72,7 +71,7 @@ static int ivshmemComparator(const void * a_, const void * b_)
|
||||
|
||||
bool ivshmemInit(struct IVSHMEM * dev)
|
||||
{
|
||||
assert(dev && !dev->opaque);
|
||||
DEBUG_ASSERT(dev && !dev->opaque);
|
||||
|
||||
HANDLE handle;
|
||||
HDEVINFO devInfoSet;
|
||||
@@ -195,7 +194,7 @@ bool ivshmemInit(struct IVSHMEM * dev)
|
||||
|
||||
bool ivshmemOpen(struct IVSHMEM * dev)
|
||||
{
|
||||
assert(dev && dev->opaque && !dev->mem);
|
||||
DEBUG_ASSERT(dev && dev->opaque && !dev->mem);
|
||||
|
||||
struct IVSHMEMInfo * info = (struct IVSHMEMInfo *)dev->opaque;
|
||||
|
||||
@@ -226,7 +225,7 @@ bool ivshmemOpen(struct IVSHMEM * dev)
|
||||
|
||||
void ivshmemClose(struct IVSHMEM * dev)
|
||||
{
|
||||
assert(dev && dev->opaque && dev->mem);
|
||||
DEBUG_ASSERT(dev && dev->opaque && dev->mem);
|
||||
|
||||
struct IVSHMEMInfo * info = (struct IVSHMEMInfo *)dev->opaque;
|
||||
|
||||
@@ -239,7 +238,7 @@ void ivshmemClose(struct IVSHMEM * dev)
|
||||
|
||||
void ivshmemFree(struct IVSHMEM * dev)
|
||||
{
|
||||
assert(dev && dev->opaque && !dev->mem);
|
||||
DEBUG_ASSERT(dev && dev->opaque && !dev->mem);
|
||||
|
||||
struct IVSHMEMInfo * info = (struct IVSHMEMInfo *)dev->opaque;
|
||||
|
||||
|
Reference in New Issue
Block a user