mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-09 20:24:14 +00:00
[client] use variable-relative sizeof where possible
This commit is contained in:

committed by
Geoffrey McRae

parent
1c5620ba25
commit
14ad83c6b8
@@ -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;
|
||||
|
@@ -41,7 +41,7 @@ struct ll
|
||||
|
||||
struct ll * ll_new(void)
|
||||
{
|
||||
struct ll * list = malloc(sizeof(struct ll));
|
||||
struct ll * list = malloc(sizeof(*list));
|
||||
list->head = NULL;
|
||||
list->tail = NULL;
|
||||
list->pos = NULL;
|
||||
@@ -61,7 +61,7 @@ void ll_free(struct ll * list)
|
||||
|
||||
void ll_push(struct ll * list, void * data)
|
||||
{
|
||||
struct ll_item * item = malloc(sizeof(struct ll_item));
|
||||
struct ll_item * item = malloc(sizeof(*item));
|
||||
item->data = data;
|
||||
item->next = NULL;
|
||||
|
||||
|
@@ -198,7 +198,7 @@ struct LG_OverlayOps LGOverlayGraphs =
|
||||
|
||||
GraphHandle overlayGraph_register(const char * name, RingBuffer buffer, float min, float max)
|
||||
{
|
||||
struct OverlayGraph * graph = malloc(sizeof(struct OverlayGraph));
|
||||
struct OverlayGraph * graph = malloc(sizeof(*graph));
|
||||
graph->name = name;
|
||||
graph->buffer = buffer;
|
||||
graph->enabled = true;
|
||||
|
Reference in New Issue
Block a user