mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-25 23:13:39 +00:00
[common] all: switch asserts to DEBUG_ASSERT
This commit is contained in:
parent
4f7ce91e7f
commit
b2630024a7
@ -26,7 +26,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct OptionGroup
|
||||
{
|
||||
@ -687,7 +686,7 @@ void option_print(void)
|
||||
"Value"
|
||||
);
|
||||
|
||||
assert(maxLen > 0);
|
||||
DEBUG_ASSERT(maxLen > 0);
|
||||
headerLine = line;
|
||||
stringlist_push(lines, line);
|
||||
|
||||
@ -709,7 +708,7 @@ void option_print(void)
|
||||
o->description
|
||||
);
|
||||
|
||||
assert(len > 0);
|
||||
DEBUG_ASSERT(len > 0);
|
||||
stringlist_push(lines, line);
|
||||
if (len > maxLen)
|
||||
maxLen = len;
|
||||
@ -765,7 +764,7 @@ int option_get_int(const char * module, const char * name)
|
||||
DEBUG_ERROR("BUG: Failed to get the value for option %s:%s", module, name);
|
||||
return -1;
|
||||
}
|
||||
assert(o->type == OPTION_TYPE_INT);
|
||||
DEBUG_ASSERT(o->type == OPTION_TYPE_INT);
|
||||
return o->value.x_int;
|
||||
}
|
||||
|
||||
@ -777,7 +776,7 @@ const char * option_get_string(const char * module, const char * name)
|
||||
DEBUG_ERROR("BUG: Failed to get the value for option %s:%s", module, name);
|
||||
return NULL;
|
||||
}
|
||||
assert(o->type == OPTION_TYPE_STRING);
|
||||
DEBUG_ASSERT(o->type == OPTION_TYPE_STRING);
|
||||
return o->value.x_string;
|
||||
}
|
||||
|
||||
@ -789,7 +788,7 @@ bool option_get_bool(const char * module, const char * name)
|
||||
DEBUG_ERROR("BUG: Failed to get the value for option %s:%s", module, name);
|
||||
return false;
|
||||
}
|
||||
assert(o->type == OPTION_TYPE_BOOL);
|
||||
DEBUG_ASSERT(o->type == OPTION_TYPE_BOOL);
|
||||
return o->value.x_bool;
|
||||
}
|
||||
|
||||
@ -801,6 +800,6 @@ float option_get_float(const char * module, const char * name)
|
||||
DEBUG_ERROR("BUG: Failed to get the value for option %s:%s", module, name);
|
||||
return false;
|
||||
}
|
||||
assert(o->type == OPTION_TYPE_FLOAT);
|
||||
DEBUG_ASSERT(o->type == OPTION_TYPE_FLOAT);
|
||||
return o->value.x_float;
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user