[PATCH weston v2 7/9] wayland-backend: split init_backend
Pekka Paalanen
ppaalanen at gmail.com
Wed May 4 12:48:55 UTC 2016
On Thu, 28 Apr 2016 20:33:14 +0200
Benoit Gschwind <gschwind at gnu-log.net> wrote:
> Extract configuration parsing from init_backend function. The new
> init_backend start by generating the configuration structure from
> configuration file with separated function and then use this structure
> to load the backend.
>
> Signed-off-by: Benoit Gschwind <gschwind at gnu-log.net>
> ---
> src/compositor-wayland.c | 179 +++++++++++++++++++++++++++++++++--------------
> 1 file changed, 127 insertions(+), 52 deletions(-)
>
> diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
> index e40403f..58593bd 100644
> --- a/src/compositor-wayland.c
> +++ b/src/compositor-wayland.c
> @@ -67,6 +67,8 @@ struct weston_wayland_backend_config {
> int fullscreen;
> char *cursor_theme;
> int cursor_size;
> + int num_outputs;
> + struct weston_wayland_backend_output_config *outputs;
> };
>
> struct wayland_backend {
> @@ -2341,18 +2343,43 @@ wayland_backend_destroy(struct wayland_backend *b)
> free(b);
> }
>
> -WL_EXPORT int
> -backend_init(struct weston_compositor *compositor, int *argc, char *argv[],
> +static void
> +wayland_backend_config_release(struct weston_wayland_backend_config *new_config) {
> + int i;
One empty line between declarations and code.
> + for (i = 0; i < new_config->num_outputs; ++i) {
> + free(new_config->outputs[i].name);
> + }
> + free(new_config->cursor_theme);
> + free(new_config->display_name);
> + free(new_config->outputs);
> +}
> +
> +/*
> + * Append a new output struct at the end of new_config.outputs and return a
> + * pointer to the newly allocated structure or NULL if fail. The allocated
> + * structure is NOT cleared nor set to default values.
> + */
> +static struct weston_wayland_backend_output_config *
> +wayland_backend_config_add_new_output(struct weston_wayland_backend_config *new_config) {
> + struct weston_wayland_backend_output_config *outputs;
> + outputs = realloc(new_config->outputs,
> + (new_config->num_outputs+1)*sizeof(struct weston_wayland_backend_output_config));
All binary operators must have spaces on both sides.
> + if (!outputs)
> + return NULL;
> + new_config->num_outputs += 1;
> + new_config->outputs = outputs;
> + return &(new_config->outputs[new_config->num_outputs-1]);
All binary operators must have spaces on both sides.
> +}
> +
A whitespace fix-up patch would be welcome.
Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20160504/350ac591/attachment.sig>
More information about the wayland-devel
mailing list