[client] use variable-relative sizeof where possible

This commit is contained in:
Tudor Brindus
2021-08-15 12:18:22 -04:00
committed by Geoffrey McRae
parent 1c5620ba25
commit 14ad83c6b8
14 changed files with 25 additions and 25 deletions

View File

@@ -216,7 +216,7 @@ void app_clipboardRequest(const LG_ClipboardReplyFn replyFn, void * opaque)
if (!g_params.clipboardToLocal)
return;
struct CBRequest * cbr = (struct CBRequest *)malloc(sizeof(struct CBRequest));
struct CBRequest * cbr = (struct CBRequest *)malloc(sizeof(*cbr));
cbr->type = g_state.cbType;
cbr->replyFn = replyFn;
@@ -658,7 +658,7 @@ KeybindHandle app_registerKeybind(int sc, KeybindFn callback, void * opaque, con
return NULL;
}
KeybindHandle handle = (KeybindHandle)malloc(sizeof(struct KeybindHandle));
KeybindHandle handle = (KeybindHandle)malloc(sizeof(*handle));
handle->sc = sc;
handle->callback = callback;
handle->opaque = opaque;
@@ -711,7 +711,7 @@ void app_registerOverlay(const struct LG_OverlayOps * ops, const void * params)
{
ASSERT_LG_OVERLAY_VALID(ops);
struct Overlay * overlay = malloc(sizeof(struct Overlay));
struct Overlay * overlay = malloc(sizeof(*overlay));
overlay->ops = ops;
overlay->params = params;
overlay->udata = NULL;