diff options
author | Dudemanguy <random342@airmail.cc> | 2023-01-08 12:19:14 -0600 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-01-08 12:19:14 -0600 |
commit | c5af54eb35af3d321483d8483977c3ba2fc12bd8 (patch) | |
tree | 66dcba7c9922d1c534881e93af90c945ee8db0bb | |
parent | 96773f39e17f59bcf6bb383e521853aea19c8177 (diff) | |
download | mpv-c5af54eb35af3d321483d8483977c3ba2fc12bd8.tar.bz2 mpv-c5af54eb35af3d321483d8483977c3ba2fc12bd8.tar.xz |
vo_dmabuf_wayland: goto err instead of returning
Returning early is clearly wrong. It should use to goto to cleanup after
itself. Also renamed from error_out to err for purely comestic reasons.
-rw-r--r-- | video/out/vo_dmabuf_wayland.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/video/out/vo_dmabuf_wayland.c b/video/out/vo_dmabuf_wayland.c index e6ce97f643..726d0a79af 100644 --- a/video/out/vo_dmabuf_wayland.c +++ b/video/out/vo_dmabuf_wayland.c @@ -315,31 +315,31 @@ static int preinit(struct vo *vo) p->global = vo->global; p->ctx = ra_ctx_create_by_name(vo, "wldmabuf"); if (!p->ctx) - goto err_out; + goto err; assert(p->ctx->ra); if (!vo->wl->dmabuf) { MP_FATAL(vo->wl, "Compositor doesn't support the %s protocol!\n", zwp_linux_dmabuf_v1_interface.name); - return VO_ERROR; + goto err; } if (!vo->wl->shm) { MP_FATAL(vo->wl, "Compositor doesn't support the %s protocol!\n", wl_shm_interface.name); - return VO_ERROR; + goto err; } if (!vo->wl->video_subsurface) { MP_FATAL(vo->wl, "Compositor doesn't support the %s protocol!\n", wl_subcompositor_interface.name); - return VO_ERROR; + goto err; } if (!vo->wl->viewport) { MP_FATAL(vo->wl, "Compositor doesn't support the %s protocol!\n", wp_viewporter_interface.name); - return VO_ERROR; + goto err; } @@ -354,15 +354,15 @@ static int preinit(struct vo *vo) int stride = MP_ALIGN_UP(width * 4, 16); int fd = vo_wayland_allocate_memfd(vo, stride); if (fd < 0) - return VO_ERROR; + goto err; p->solid_buffer_pool = wl_shm_create_pool(vo->wl->shm, fd, height * stride); if (!p->solid_buffer_pool) - return VO_ERROR; + goto err; p->solid_buffer = wl_shm_pool_create_buffer( p->solid_buffer_pool, 0, width, height, stride, WL_SHM_FORMAT_XRGB8888); } if (!p->solid_buffer) - return VO_ERROR; + goto err; wl_surface_attach(vo->wl->surface, p->solid_buffer, 0, 0); @@ -377,10 +377,10 @@ static int preinit(struct vo *vo) ra_hwdec_ctx_init(&p->hwdec_ctx, vo->hwdec_devs, NULL, true); return 0; -err_out: - uninit(vo); - return VO_ERROR; +err: + uninit(vo); + return -1; } const struct vo_driver video_out_dmabuf_wayland = { |