On Thu, 28 Apr 2016 20:33:14 +0200 Benoit Gschwind <[email protected]> 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 <[email protected]> > --- > 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
pgpVC_3QhwVRL.pgp
Description: OpenPGP digital signature
_______________________________________________ wayland-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/wayland-devel
