mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 09:59:48 +01:00
drm_format_set_union: Require initialized dst and remove assert
This commit is contained in:
parent
d7917d2076
commit
1ee75786b4
3 changed files with 4 additions and 7 deletions
|
@ -82,7 +82,8 @@ bool wlr_drm_format_set_intersect(struct wlr_drm_format_set *dst,
|
|||
|
||||
/**
|
||||
* Unions DRM format set `a` and `b`, storing in the destination set
|
||||
* `dst`.
|
||||
* `dst`. The `dst` must either be zeroed or initialized with other state
|
||||
* to be replaced.
|
||||
*
|
||||
* Returns false on failure.
|
||||
*/
|
||||
|
|
|
@ -258,8 +258,6 @@ static bool drm_format_set_extend(struct wlr_drm_format_set *dst,
|
|||
|
||||
bool wlr_drm_format_set_union(struct wlr_drm_format_set *dst,
|
||||
const struct wlr_drm_format_set *a, const struct wlr_drm_format_set *b) {
|
||||
assert(dst != a && dst != b);
|
||||
|
||||
struct wlr_drm_format_set out = {0};
|
||||
out.capacity = a->len + b->len;
|
||||
out.formats = calloc(out.capacity, sizeof(struct wlr_drm_format *));
|
||||
|
@ -276,6 +274,7 @@ bool wlr_drm_format_set_union(struct wlr_drm_format_set *dst,
|
|||
return false;
|
||||
}
|
||||
|
||||
wlr_drm_format_set_finish(dst);
|
||||
*dst = out;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -917,12 +917,9 @@ static bool set_default_feedback(struct wlr_linux_dmabuf_v1 *linux_dmabuf,
|
|||
for (size_t i = 0; i < tranches_len; i++) {
|
||||
const struct wlr_linux_dmabuf_feedback_v1_tranche *tranche = &tranches[i];
|
||||
|
||||
struct wlr_drm_format_set uni;
|
||||
if (!wlr_drm_format_set_union(&uni, &formats, &tranche->formats)) {
|
||||
if (!wlr_drm_format_set_union(&formats, &formats, &tranche->formats)) {
|
||||
goto error_formats;
|
||||
}
|
||||
wlr_drm_format_set_finish(&formats);
|
||||
formats = uni;
|
||||
}
|
||||
|
||||
compiled_feedback_destroy(linux_dmabuf->default_feedback);
|
||||
|
|
Loading…
Reference in a new issue