[client] remove all casts around malloc

The cast is unnecessary in C and should be removed to avoid clutter.
This commit is contained in:
Quantum 2021-08-15 18:55:19 -04:00 committed by Geoffrey McRae
parent fd4a4114e6
commit 81c38e825c
12 changed files with 18 additions and 18 deletions

View File

@ -153,7 +153,7 @@ static void x11CBReplyFn(void * opaque, LG_ClipboardData type,
static void x11CBSelectionRequest(const XSelectionRequestEvent e) static void x11CBSelectionRequest(const XSelectionRequestEvent e)
{ {
XEvent * s = (XEvent *)malloc(sizeof(*s)); XEvent * s = malloc(sizeof(*s));
s->xselection.type = SelectionNotify; s->xselection.type = SelectionNotify;
s->xselection.requestor = e.requestor; s->xselection.requestor = e.requestor;
s->xselection.selection = e.selection; s->xselection.selection = e.selection;

View File

@ -135,7 +135,7 @@ static void cursorTexFree(struct CursorTex * t)
bool egl_cursorInit(EGL_Cursor ** cursor) bool egl_cursorInit(EGL_Cursor ** cursor)
{ {
*cursor = (EGL_Cursor *)malloc(sizeof(**cursor)); *cursor = malloc(sizeof(**cursor));
if (!*cursor) if (!*cursor)
{ {
DEBUG_ERROR("Failed to malloc EGL_Cursor"); DEBUG_ERROR("Failed to malloc EGL_Cursor");
@ -206,7 +206,7 @@ bool egl_cursorSetShape(EGL_Cursor * cursor, const LG_RendererCursor type,
if (cursor->data) if (cursor->data)
free(cursor->data); free(cursor->data);
cursor->data = (uint8_t *)malloc(size); cursor->data = malloc(size);
if (!cursor->data) if (!cursor->data)
{ {
DEBUG_ERROR("Failed to malloc buffer for cursor shape"); DEBUG_ERROR("Failed to malloc buffer for cursor shape");

View File

@ -59,7 +59,7 @@ void egl_damageConfigUI(EGL_Damage * damage)
bool egl_damageInit(EGL_Damage ** damage) bool egl_damageInit(EGL_Damage ** damage)
{ {
*damage = (EGL_Damage *)malloc(sizeof(**damage)); *damage = malloc(sizeof(**damage));
if (!*damage) if (!*damage)
{ {
DEBUG_ERROR("Failed to malloc EGL_Damage"); DEBUG_ERROR("Failed to malloc EGL_Damage");

View File

@ -116,7 +116,7 @@ static bool egl_initDesktopShader(
bool egl_desktopInit(EGL * egl, EGL_Desktop ** desktop_, EGLDisplay * display, bool egl_desktopInit(EGL * egl, EGL_Desktop ** desktop_, EGLDisplay * display,
bool useDMA, int maxRects) bool useDMA, int maxRects)
{ {
EGL_Desktop * desktop = (EGL_Desktop *)calloc(1, sizeof(EGL_Desktop)); EGL_Desktop * desktop = calloc(1, sizeof(EGL_Desktop));
if (!desktop) if (!desktop)
{ {
DEBUG_ERROR("Failed to malloc EGL_Desktop"); DEBUG_ERROR("Failed to malloc EGL_Desktop");

View File

@ -25,7 +25,7 @@
void egl_drawTorus(EGL_Model * model, unsigned int pts, float x, float y, void egl_drawTorus(EGL_Model * model, unsigned int pts, float x, float y,
float inner, float outer) float inner, float outer)
{ {
GLfloat * v = (GLfloat *)malloc(sizeof(*v) * (pts + 1) * 6); GLfloat * v = malloc(sizeof(*v) * (pts + 1) * 6);
GLfloat * dst = v; GLfloat * dst = v;
for(unsigned int i = 0; i <= pts; ++i) for(unsigned int i = 0; i <= pts; ++i)
@ -48,7 +48,7 @@ void egl_drawTorus(EGL_Model * model, unsigned int pts, float x, float y,
void egl_drawTorusArc(EGL_Model * model, unsigned int pts, float x, float y, void egl_drawTorusArc(EGL_Model * model, unsigned int pts, float x, float y,
float inner, float outer, float s, float e) float inner, float outer, float s, float e)
{ {
GLfloat * v = (GLfloat *)malloc(sizeof(*v) * (pts + 1) * 6); GLfloat * v = malloc(sizeof(*v) * (pts + 1) * 6);
GLfloat * dst = v; GLfloat * dst = v;
for(unsigned int i = 0; i <= pts; ++i) for(unsigned int i = 0; i <= pts; ++i)

View File

@ -54,7 +54,7 @@ void update_uniform_bindings(EGL_Model * model);
bool egl_modelInit(EGL_Model ** model) bool egl_modelInit(EGL_Model ** model)
{ {
*model = (EGL_Model *)malloc(sizeof(**model)); *model = malloc(sizeof(**model));
if (!*model) if (!*model)
{ {
DEBUG_ERROR("Failed to malloc EGL_Model"); DEBUG_ERROR("Failed to malloc EGL_Model");
@ -123,11 +123,11 @@ void egl_modelSetDefault(EGL_Model * model, bool flipped)
void egl_modelAddVerts(EGL_Model * model, const GLfloat * verticies, const GLfloat * uvs, const size_t count) void egl_modelAddVerts(EGL_Model * model, const GLfloat * verticies, const GLfloat * uvs, const size_t count)
{ {
struct FloatList * fl = (struct FloatList *)malloc(sizeof(*fl)); struct FloatList * fl = malloc(sizeof(*fl));
fl->count = count; fl->count = count;
fl->v = (GLfloat *)malloc(sizeof(GLfloat) * count * 3); fl->v = malloc(sizeof(GLfloat) * count * 3);
fl->u = (GLfloat *)malloc(sizeof(GLfloat) * count * 2); fl->u = malloc(sizeof(GLfloat) * count * 2);
memcpy(fl->v, verticies, sizeof(GLfloat) * count * 3); memcpy(fl->v, verticies, sizeof(GLfloat) * count * 3);
if (uvs) if (uvs)

View File

@ -38,7 +38,7 @@ struct EGL_Shader
bool egl_shaderInit(EGL_Shader ** this) bool egl_shaderInit(EGL_Shader ** this)
{ {
*this = (EGL_Shader *)calloc(1, sizeof(EGL_Shader)); *this = calloc(1, sizeof(EGL_Shader));
if (!*this) if (!*this)
{ {
DEBUG_ERROR("Failed to malloc EGL_Shader"); DEBUG_ERROR("Failed to malloc EGL_Shader");

View File

@ -51,7 +51,7 @@ struct EGL_Splash
bool egl_splashInit(EGL_Splash ** splash) bool egl_splashInit(EGL_Splash ** splash)
{ {
*splash = (EGL_Splash *)malloc(sizeof(**splash)); *splash = malloc(sizeof(**splash));
if (!*splash) if (!*splash)
{ {
DEBUG_ERROR("Failed to malloc EGL_Splash"); DEBUG_ERROR("Failed to malloc EGL_Splash");

View File

@ -51,7 +51,7 @@ bool egl_texBufferInit(EGL_Texture ** texture, EGLDisplay * display)
TextureBuffer * this; TextureBuffer * this;
if (!*texture) if (!*texture)
{ {
this = (TextureBuffer *)calloc(1, sizeof(*this)); this = calloc(1, sizeof(*this));
if (!this) if (!this)
{ {
DEBUG_ERROR("Failed to malloc TexB"); DEBUG_ERROR("Failed to malloc TexB");

View File

@ -57,7 +57,7 @@ static void egl_texDMABUFCleanup(TexDMABUF * this)
static bool egl_texDMABUFInit(EGL_Texture ** texture, EGLDisplay * display) static bool egl_texDMABUFInit(EGL_Texture ** texture, EGLDisplay * display)
{ {
TexDMABUF * this = (TexDMABUF *)calloc(1, sizeof(*this)); TexDMABUF * this = calloc(1, sizeof(*this));
*texture = &this->base.base; *texture = &this->base.base;
EGL_Texture * parent = &this->base.base; EGL_Texture * parent = &this->base.base;

View File

@ -326,7 +326,7 @@ bool opengl_onMouseShape(LG_Renderer * renderer, const LG_RendererCursor cursor,
{ {
if (this->mouseData) if (this->mouseData)
free(this->mouseData); free(this->mouseData);
this->mouseData = (uint8_t *)malloc(size); this->mouseData = malloc(size);
this->mouseDataSize = size; this->mouseDataSize = size;
} }

View File

@ -216,7 +216,7 @@ void app_clipboardRequest(const LG_ClipboardReplyFn replyFn, void * opaque)
if (!g_params.clipboardToLocal) if (!g_params.clipboardToLocal)
return; return;
struct CBRequest * cbr = (struct CBRequest *)malloc(sizeof(*cbr)); struct CBRequest * cbr = malloc(sizeof(*cbr));
cbr->type = g_state.cbType; cbr->type = g_state.cbType;
cbr->replyFn = replyFn; cbr->replyFn = replyFn;
@ -661,7 +661,7 @@ KeybindHandle app_registerKeybind(int sc, KeybindFn callback, void * opaque, con
return NULL; return NULL;
} }
KeybindHandle handle = (KeybindHandle)malloc(sizeof(*handle)); KeybindHandle handle = malloc(sizeof(*handle));
handle->sc = sc; handle->sc = sc;
handle->callback = callback; handle->callback = callback;
handle->opaque = opaque; handle->opaque = opaque;