[PATCH weston v3 08/17] compositor-wayland: refactor load_wayland_backend

Benoit Gschwind gschwind at gnu-log.net
Thu May 5 20:45:46 UTC 2016


Rename variable new_config to config in load_wayland_backend function.

Signed-off-by: Benoit Gschwind <gschwind at gnu-log.net>
---
 src/main.c | 54 +++++++++++++++++++++++++++---------------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/src/main.c b/src/main.c
index 2ff8cd7..8d42ec5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1043,7 +1043,7 @@ static int
 load_wayland_backend(struct weston_compositor *c, char const * backend,
 		     int *argc, char *argv[], struct weston_config *wc)
 {
-	struct weston_wayland_backend_config new_config = {{ 0, }};
+	struct weston_wayland_backend_config config = {{ 0, }};
 	struct weston_config_section *section;
 	struct weston_wayland_backend_output_config *oc;
 	int count, width, height, scale;
@@ -1055,44 +1055,44 @@ load_wayland_backend(struct weston_compositor *c, char const * backend,
 		{ WESTON_OPTION_INTEGER, "width", 0, &width },
 		{ WESTON_OPTION_INTEGER, "height", 0, &height },
 		{ WESTON_OPTION_INTEGER, "scale", 0, &scale },
-		{ WESTON_OPTION_STRING, "display", 0, &new_config.display_name },
-		{ WESTON_OPTION_BOOLEAN, "use-pixman", 0, &new_config.use_pixman },
+		{ WESTON_OPTION_STRING, "display", 0, &config.display_name },
+		{ WESTON_OPTION_BOOLEAN, "use-pixman", 0, &config.use_pixman },
 		{ WESTON_OPTION_INTEGER, "output-count", 0, &count },
-		{ WESTON_OPTION_BOOLEAN, "fullscreen", 0, &new_config.fullscreen },
-		{ WESTON_OPTION_BOOLEAN, "sprawl", 0, &new_config.sprawl },
+		{ WESTON_OPTION_BOOLEAN, "fullscreen", 0, &config.fullscreen },
+		{ WESTON_OPTION_BOOLEAN, "sprawl", 0, &config.sprawl },
 	};
 
 	width = 0;
 	height = 0;
 	scale = 0;
-	new_config.display_name = NULL;
-	new_config.use_pixman = 0;
+	config.display_name = NULL;
+	config.use_pixman = 0;
 	count = 1;
-	new_config.fullscreen = 0;
-	new_config.sprawl = 0;
+	config.fullscreen = 0;
+	config.sprawl = 0;
 	parse_options(wayland_options,
 		      ARRAY_LENGTH(wayland_options), argc, argv);
 
-	new_config.cursor_size = 32;
-	new_config.cursor_theme = NULL;
-	new_config.base.struct_size = sizeof(struct weston_wayland_backend_config);
-	new_config.base.struct_version = WESTON_WAYLAND_BACKEND_CONFIG_VERSION;
+	config.cursor_size = 32;
+	config.cursor_theme = NULL;
+	config.base.struct_size = sizeof(struct weston_wayland_backend_config);
+	config.base.struct_version = WESTON_WAYLAND_BACKEND_CONFIG_VERSION;
 
 	section = weston_config_get_section(wc, "shell", NULL, NULL);
 	weston_config_section_get_string(section, "cursor-theme",
-					 &new_config.cursor_theme, NULL);
+					 &config.cursor_theme, NULL);
 	weston_config_section_get_int(section, "cursor-size",
-				      &new_config.cursor_size, 32);
+				      &config.cursor_size, 32);
 
-	if (new_config.sprawl) {
+	if (config.sprawl) {
 		/* do nothing, everything is already set */
-		ret = load_backend_new(c, backend, &new_config.base);
-		wayland_backend_config_release(&new_config);
+		ret = load_backend_new(c, backend, &config.base);
+		wayland_backend_config_release(&config);
 		return ret;
 	}
 
-	if (new_config.fullscreen) {
-		oc = wayland_backend_config_add_new_output(&new_config);
+	if (config.fullscreen) {
+		oc = wayland_backend_config_add_new_output(&config);
 		if (!oc) {
 			ret = -1;
 			goto err_outputs;
@@ -1104,8 +1104,8 @@ load_wayland_backend(struct weston_compositor *c, char const * backend,
 		oc->transform = WL_OUTPUT_TRANSFORM_NORMAL;
 		oc->scale = 1;
 
-		ret = load_backend_new(c, backend, &new_config.base);
-		wayland_backend_config_release(&new_config);
+		ret = load_backend_new(c, backend, &config.base);
+		wayland_backend_config_release(&config);
 		return ret;
 	}
 
@@ -1123,7 +1123,7 @@ load_wayland_backend(struct weston_compositor *c, char const * backend,
 		}
 		free(name);
 
-		oc = wayland_backend_config_add_new_output(&new_config);
+		oc = wayland_backend_config_add_new_output(&config);
 
 		if (!oc) {
 			ret = -1;
@@ -1143,7 +1143,7 @@ load_wayland_backend(struct weston_compositor *c, char const * backend,
 		scale = 1;
 	while (count > 0) {
 
-		oc = wayland_backend_config_add_new_output(&new_config);
+		oc = wayland_backend_config_add_new_output(&config);
 
 		if (!oc) {
 			ret = -1;
@@ -1159,12 +1159,12 @@ load_wayland_backend(struct weston_compositor *c, char const * backend,
 		--count;
 	}
 
-	ret = load_backend_new(c, backend, &new_config.base);
-	wayland_backend_config_release(&new_config);
+	ret = load_backend_new(c, backend, &config.base);
+	wayland_backend_config_release(&config);
 	return ret;
 
 err_outputs:
-	wayland_backend_config_release(&new_config);
+	wayland_backend_config_release(&config);
 	return ret;
 }
 
-- 
2.7.3



More information about the wayland-devel mailing list