[PATCH weston] libweston: drop return type from ::query_dmabuf_{formats, modifiers}

Emil Velikov emil.l.velikov at gmail.com
Tue Dec 5 14:26:16 UTC 2017


From: Emil Velikov <emil.velikov at collabora.com>

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 <emil.velikov at collabora.com>
---
 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 769203a1..a4ac6355 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -748,10 +748,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 7844f676..51e9d84a 100644
--- a/libweston/gl-renderer.c
+++ b/libweston/gl-renderer.c
@@ -1901,7 +1901,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)
 {
@@ -1913,25 +1913,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)
@@ -1945,23 +1944,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
-- 
2.15.0



More information about the wayland-devel mailing list