mirror of
https://gitlab.freedesktop.org/emersion/libliftoff.git
synced 2024-11-16 19:47:55 +01:00
Use initializers instead of memset()
This is more type-safe.
This commit is contained in:
parent
f53b541473
commit
4e11884228
2 changed files with 6 additions and 5 deletions
5
alloc.c
5
alloc.c
|
@ -835,7 +835,8 @@ update_layers_fb_info(struct liftoff_output *output)
|
|||
* re-created a completely different one which happens to have the same
|
||||
* FB ID. */
|
||||
liftoff_list_for_each(layer, &output->layers, link) {
|
||||
memset(&layer->fb_info, 0, sizeof(layer->fb_info));
|
||||
layer->fb_info = (drmModeFB2){0};
|
||||
|
||||
layer_cache_fb_info(layer);
|
||||
/* TODO: propagate error? */
|
||||
}
|
||||
|
@ -964,7 +965,7 @@ liftoff_output_apply(struct liftoff_output *output, drmModeAtomicReq *req,
|
|||
* before any other plane. */
|
||||
|
||||
result.best_score = -1;
|
||||
memset(result.best, 0, result.planes_len * sizeof(*result.best));
|
||||
memset(result.best, 0, result.planes_len * sizeof(result.best[0]));
|
||||
result.has_composition_layer = output->composition_layer != NULL;
|
||||
result.non_composition_layers_len =
|
||||
non_composition_layers_length(output);
|
||||
|
|
6
layer.c
6
layer.c
|
@ -87,7 +87,7 @@ liftoff_layer_set_property(struct liftoff_layer *layer, const char *name,
|
|||
layer->props_len++;
|
||||
|
||||
prop = &layer->props[layer->props_len - 1];
|
||||
memset(prop, 0, sizeof(*prop));
|
||||
*prop = (struct liftoff_layer_property){0};
|
||||
strncpy(prop->name, name, sizeof(prop->name) - 1);
|
||||
|
||||
layer->changed = true;
|
||||
|
@ -117,7 +117,7 @@ liftoff_layer_unset_property(struct liftoff_layer *layer, const char *name)
|
|||
if (prop != last) {
|
||||
*prop = *last;
|
||||
}
|
||||
memset(last, 0, sizeof(*last));
|
||||
*last = (struct liftoff_layer_property){0};
|
||||
layer->props_len--;
|
||||
|
||||
layer->changed = true;
|
||||
|
@ -262,7 +262,7 @@ layer_cache_fb_info(struct liftoff_layer *layer)
|
|||
|
||||
fb_id_prop = layer_get_property(layer, "FB_ID");
|
||||
if (fb_id_prop == NULL || fb_id_prop->value == 0) {
|
||||
memset(&layer->fb_info, 0, sizeof(layer->fb_info));
|
||||
layer->fb_info = (drmModeFB2){0};
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue