mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-22 21:43:40 +00:00
[client] all: replace assert with DEBUG_ASSERT
This commit is contained in:
parent
85a96d1e06
commit
579f998519
@ -20,7 +20,6 @@
|
||||
|
||||
#include "wayland.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -299,7 +298,7 @@ static void dataDeviceHandleEnter(void * data, struct wl_data_device * device,
|
||||
uint32_t serial, struct wl_surface * surface, wl_fixed_t sxW, wl_fixed_t syW,
|
||||
struct wl_data_offer * offer)
|
||||
{
|
||||
assert(wlCb.dndOffer == NULL);
|
||||
DEBUG_ASSERT(wlCb.dndOffer == NULL);
|
||||
wlCb.dndOffer = offer;
|
||||
|
||||
struct DataOffer * extra = wl_data_offer_get_user_data(offer);
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <EGL/egl.h>
|
||||
#include "common/types.h"
|
||||
#include "common/debug.h"
|
||||
|
||||
typedef enum LG_ClipboardData
|
||||
{
|
||||
@ -210,50 +211,50 @@ struct LG_DisplayServerOps
|
||||
};
|
||||
|
||||
#ifdef ENABLE_EGL
|
||||
#define ASSERT_EGL_FN(x) assert(x);
|
||||
#define ASSERT_EGL_FN(x) DEBUG_ASSERT(x)
|
||||
#else
|
||||
#define ASSERT_EGL_FN(x)
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_OPENGL
|
||||
#define ASSERT_OPENGL_FN(x) assert(x)
|
||||
#define ASSERT_OPENGL_FN(x) DEBUG_ASSERT(x)
|
||||
#else
|
||||
#define ASSERT_OPENGL_FN(x)
|
||||
#endif
|
||||
|
||||
#define ASSERT_LG_DS_VALID(x) \
|
||||
assert((x)->setup ); \
|
||||
assert((x)->probe ); \
|
||||
assert((x)->earlyInit ); \
|
||||
assert((x)->init ); \
|
||||
assert((x)->startup ); \
|
||||
assert((x)->shutdown ); \
|
||||
assert((x)->free ); \
|
||||
assert((x)->getProp ); \
|
||||
ASSERT_EGL_FN((x)->getEGLDisplay ); \
|
||||
ASSERT_EGL_FN((x)->getEGLNativeWindow ); \
|
||||
ASSERT_EGL_FN((x)->eglSwapBuffers ); \
|
||||
DEBUG_ASSERT((x)->setup ); \
|
||||
DEBUG_ASSERT((x)->probe ); \
|
||||
DEBUG_ASSERT((x)->earlyInit); \
|
||||
DEBUG_ASSERT((x)->init ); \
|
||||
DEBUG_ASSERT((x)->startup ); \
|
||||
DEBUG_ASSERT((x)->shutdown ); \
|
||||
DEBUG_ASSERT((x)->free ); \
|
||||
DEBUG_ASSERT((x)->getProp ); \
|
||||
ASSERT_EGL_FN((x)->getEGLDisplay ); \
|
||||
ASSERT_EGL_FN((x)->getEGLNativeWindow); \
|
||||
ASSERT_EGL_FN((x)->eglSwapBuffers ); \
|
||||
ASSERT_OPENGL_FN((x)->glCreateContext ); \
|
||||
ASSERT_OPENGL_FN((x)->glDeleteContext ); \
|
||||
ASSERT_OPENGL_FN((x)->glMakeCurrent ); \
|
||||
ASSERT_OPENGL_FN((x)->glSetSwapInterval); \
|
||||
ASSERT_OPENGL_FN((x)->glSwapBuffers ); \
|
||||
assert(!(x)->waitFrame == !(x)->stopWaitFrame); \
|
||||
assert((x)->guestPointerUpdated); \
|
||||
assert((x)->setPointer ); \
|
||||
assert((x)->grabPointer ); \
|
||||
assert((x)->ungrabPointer ); \
|
||||
assert((x)->capturePointer ); \
|
||||
assert((x)->uncapturePointer ); \
|
||||
assert((x)->warpPointer ); \
|
||||
assert((x)->realignPointer ); \
|
||||
assert((x)->isValidPointerPos ); \
|
||||
assert((x)->inhibitIdle ); \
|
||||
assert((x)->uninhibitIdle ); \
|
||||
assert((x)->wait ); \
|
||||
assert((x)->setWindowSize ); \
|
||||
assert((x)->setFullscreen ); \
|
||||
assert((x)->getFullscreen ); \
|
||||
assert((x)->minimize );
|
||||
DEBUG_ASSERT(!(x)->waitFrame == !(x)->stopWaitFrame); \
|
||||
DEBUG_ASSERT((x)->guestPointerUpdated); \
|
||||
DEBUG_ASSERT((x)->setPointer ); \
|
||||
DEBUG_ASSERT((x)->grabPointer ); \
|
||||
DEBUG_ASSERT((x)->ungrabPointer ); \
|
||||
DEBUG_ASSERT((x)->capturePointer ); \
|
||||
DEBUG_ASSERT((x)->uncapturePointer ); \
|
||||
DEBUG_ASSERT((x)->warpPointer ); \
|
||||
DEBUG_ASSERT((x)->realignPointer ); \
|
||||
DEBUG_ASSERT((x)->isValidPointerPos ); \
|
||||
DEBUG_ASSERT((x)->inhibitIdle ); \
|
||||
DEBUG_ASSERT((x)->uninhibitIdle ); \
|
||||
DEBUG_ASSERT((x)->wait ); \
|
||||
DEBUG_ASSERT((x)->setWindowSize ); \
|
||||
DEBUG_ASSERT((x)->setFullscreen ); \
|
||||
DEBUG_ASSERT((x)->getFullscreen ); \
|
||||
DEBUG_ASSERT((x)->minimize );
|
||||
|
||||
#endif
|
||||
|
@ -22,7 +22,6 @@
|
||||
#define _H_I_OVERLAY_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "common/types.h"
|
||||
|
||||
@ -64,9 +63,9 @@ struct LG_OverlayOps
|
||||
};
|
||||
|
||||
#define ASSERT_LG_OVERLAY_VALID(x) \
|
||||
assert((x)->name ); \
|
||||
assert((x)->init ); \
|
||||
assert((x)->free ); \
|
||||
assert((x)->render );
|
||||
DEBUG_ASSERT((x)->name ); \
|
||||
DEBUG_ASSERT((x)->init ); \
|
||||
DEBUG_ASSERT((x)->free ); \
|
||||
DEBUG_ASSERT((x)->render);
|
||||
|
||||
#endif
|
||||
|
@ -119,7 +119,7 @@ void egl_desktopRectsUpdate(EGL_DesktopRects * rects, const struct DamageRects *
|
||||
else
|
||||
{
|
||||
rects->count = data->count;
|
||||
assert(rects->count <= rects->maxCount);
|
||||
DEBUG_ASSERT(rects->count <= rects->maxCount);
|
||||
|
||||
for (int i = 0; i < rects->count; ++i)
|
||||
rectToVertices(vertices + i * 8, data->rects + i);
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct EGL_Model
|
||||
{
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "texture.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include "shader.h"
|
||||
#include "common/framebuffer.h"
|
||||
@ -66,12 +65,12 @@ bool egl_textureInit(EGL_Texture ** texture_, EGLDisplay * display,
|
||||
break;
|
||||
|
||||
case EGL_TEXTYPE_FRAMEBUFFER:
|
||||
assert(streaming);
|
||||
DEBUG_ASSERT(streaming);
|
||||
ops = &EGL_TextureFrameBuffer;
|
||||
break;
|
||||
|
||||
case EGL_TEXTYPE_DMABUF:
|
||||
assert(streaming);
|
||||
DEBUG_ASSERT(streaming);
|
||||
ops = &EGL_TextureDMABUF;
|
||||
break;
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "egldebug.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
// forwards
|
||||
extern const EGL_TextureOps EGL_TextureBuffer;
|
||||
@ -109,7 +108,7 @@ bool egl_texBufferSetup(EGL_Texture * texture, const EGL_TexSetup * setup)
|
||||
static bool egl_texBufferUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
|
||||
{
|
||||
TextureBuffer * this = UPCAST(TextureBuffer, texture);
|
||||
assert(update->type == EGL_TEXTYPE_BUFFER);
|
||||
DEBUG_ASSERT(update->type == EGL_TEXTYPE_BUFFER);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, this->tex[0]);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, texture->format.pitch);
|
||||
@ -164,7 +163,7 @@ static bool egl_texBufferStreamUpdate(EGL_Texture * texture,
|
||||
const EGL_TexUpdate * update)
|
||||
{
|
||||
TextureBuffer * this = UPCAST(TextureBuffer, texture);
|
||||
assert(update->type == EGL_TEXTYPE_BUFFER);
|
||||
DEBUG_ASSERT(update->type == EGL_TEXTYPE_BUFFER);
|
||||
|
||||
LG_LOCK(this->copyLock);
|
||||
memcpy(this->buf[this->bufIndex].map, update->buffer,
|
||||
|
@ -21,8 +21,6 @@
|
||||
#include "texture.h"
|
||||
#include "texture_buffer.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "egl_dynprocs.h"
|
||||
#include "egldebug.h"
|
||||
|
||||
@ -101,7 +99,8 @@ static bool egl_texDMABUFUpdate(EGL_Texture * texture,
|
||||
{
|
||||
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
||||
TexDMABUF * this = UPCAST(TexDMABUF , parent);
|
||||
assert(update->type == EGL_TEXTYPE_DMABUF);
|
||||
|
||||
DEBUG_ASSERT(update->type == EGL_TEXTYPE_DMABUF);
|
||||
|
||||
EGLImage image = EGL_NO_IMAGE;
|
||||
|
||||
|
@ -20,8 +20,6 @@
|
||||
|
||||
#include "texture.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "texture_buffer.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/KVMFR.h"
|
||||
@ -84,7 +82,7 @@ static bool egl_texFBUpdate(EGL_Texture * texture, const EGL_TexUpdate * update)
|
||||
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
||||
TexFB * this = UPCAST(TexFB , parent );
|
||||
|
||||
assert(update->type == EGL_TEXTYPE_FRAMEBUFFER);
|
||||
DEBUG_ASSERT(update->type == EGL_TEXTYPE_FRAMEBUFFER);
|
||||
|
||||
LG_LOCK(parent->copyLock);
|
||||
|
||||
|
@ -804,7 +804,7 @@ int app_renderOverlay(struct Rect * rects, int maxRects)
|
||||
|
||||
// It is an error to run out of rectangles, because we will not be able to
|
||||
// correctly calculate the damage of the next frame.
|
||||
assert(written >= 0);
|
||||
DEBUG_ASSERT(written >= 0);
|
||||
|
||||
const int toAdd = max(written, overlay->lastRectCount);
|
||||
totalDamage |= toAdd > maxRects;
|
||||
|
@ -20,9 +20,9 @@
|
||||
|
||||
#include "ll.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/locking.h"
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct ll_item
|
||||
{
|
||||
@ -53,7 +53,7 @@ struct ll * ll_new(void)
|
||||
void ll_free(struct ll * list)
|
||||
{
|
||||
// never free a list with items in it!
|
||||
assert(!list->head);
|
||||
DEBUG_ASSERT(!list->head);
|
||||
|
||||
LG_LOCK_FREE(list->lock);
|
||||
free(list);
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdatomic.h>
|
||||
#include <linux/input.h>
|
||||
@ -854,7 +853,7 @@ static int lg_run(void)
|
||||
break;
|
||||
}
|
||||
|
||||
assert(g_state.ds);
|
||||
DEBUG_ASSERT(g_state.ds);
|
||||
ASSERT_LG_DS_VALID(g_state.ds);
|
||||
|
||||
if (g_params.jitRender)
|
||||
|
Loading…
Reference in New Issue
Block a user