From fbf165f5e89576730eed4a7e3979100311c4f0f8 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Tue, 5 Dec 2017 14:26:16 +0000 Subject: [PATCH] libweston: drop return type from ::query_dmabuf_{formats, modifiers} Nobody checks for the bool returned by these functions. At the same time: a) the functions set the respective num_foo to zero on error and b) callers honour that variable. Just drop the return type - it's useless. Note: this is an ABI break. Signed-off-by: Emil Velikov Reviewed-by: Daniel Stone --- libweston/compositor.h | 6 ++++-- libweston/gl-renderer.c | 18 ++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libweston/compositor.h b/libweston/compositor.h index 97f9a2ff..dffcba89 100644 --- a/libweston/compositor.h +++ b/libweston/compositor.h @@ -755,10 +755,12 @@ struct weston_renderer { bool (*import_dmabuf)(struct weston_compositor *ec, struct linux_dmabuf_buffer *buffer); - bool (*query_dmabuf_formats)(struct weston_compositor *ec, + /** On error sets num_formats to zero */ + void (*query_dmabuf_formats)(struct weston_compositor *ec, int **formats, int *num_formats); - bool (*query_dmabuf_modifiers)(struct weston_compositor *ec, + /** On error sets num_modifiers to zero */ + void (*query_dmabuf_modifiers)(struct weston_compositor *ec, int format, uint64_t **modifiers, int *num_modifiers); }; diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c index 5a4b83cd..abf556f0 100644 --- a/libweston/gl-renderer.c +++ b/libweston/gl-renderer.c @@ -2083,7 +2083,7 @@ import_dmabuf(struct gl_renderer *gr, return image; } -static bool +static void gl_renderer_query_dmabuf_formats(struct weston_compositor *wc, int **formats, int *num_formats) { @@ -2095,25 +2095,24 @@ gl_renderer_query_dmabuf_formats(struct weston_compositor *wc, if (!gr->has_dmabuf_import_modifiers || !gr->query_dmabuf_formats(gr->egl_display, 0, NULL, &num)) { *num_formats = 0; - return false; + return; } *formats = calloc(num, sizeof(int)); if (*formats == NULL) { *num_formats = 0; - return false; + return; } if (!gr->query_dmabuf_formats(gr->egl_display, num, *formats, &num)) { *num_formats = 0; free(*formats); - return false; + return; } *num_formats = num; - return true; } -static bool +static void gl_renderer_query_dmabuf_modifiers(struct weston_compositor *wc, int format, uint64_t **modifiers, int *num_modifiers) @@ -2127,23 +2126,22 @@ gl_renderer_query_dmabuf_modifiers(struct weston_compositor *wc, int format, !gr->query_dmabuf_modifiers(gr->egl_display, format, 0, NULL, NULL, &num)) { *num_modifiers = 0; - return false; + return; } *modifiers = calloc(num, sizeof(uint64_t)); if (*modifiers == NULL) { *num_modifiers = 0; - return false; + return; } if (!gr->query_dmabuf_modifiers(gr->egl_display, format, num, *modifiers, NULL, &num)) { *num_modifiers = 0; free(*modifiers); - return false; + return; } *num_modifiers = num; - return true; } static bool