compositor: move code into load_configuration()
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Tue, 24 Mar 2015 13:56:18 +0000 (15:56 +0200)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Fri, 27 Mar 2015 07:38:07 +0000 (09:38 +0200)
Move the config file loading code from main() to its own function.

No functional changes.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Reviewed-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
src/compositor.c

index f42fd17369b6afd852dfe560351765aeb84f0fcd..63450389184f58621713afc518ce19e5518d30b4 100644 (file)
@@ -5212,6 +5212,23 @@ weston_transform_to_string(uint32_t output_transform)
        return "<illegal value>";
 }
 
+static int
+load_configuration(struct weston_config **config, int32_t noconfig)
+{
+       *config = NULL;
+
+       if (noconfig == 0)
+               *config = weston_config_parse("weston.ini");
+
+       if (*config) {
+               weston_log("Using config file '%s'\n",
+                          weston_config_get_full_path(*config));
+       } else {
+               weston_log("Starting with no config file.\n");
+       }
+
+       return 0;
+}
 
 int main(int argc, char *argv[])
 {
@@ -5237,7 +5254,7 @@ int main(int argc, char *argv[])
        int32_t version = 0;
        int32_t noconfig = 0;
        int32_t numlock_on;
-       struct weston_config *config = NULL;
+       struct weston_config *config;
        struct weston_config_section *section;
        struct wl_client *primary_client;
        struct wl_listener primary_client_destroyed;
@@ -5294,14 +5311,9 @@ int main(int argc, char *argv[])
        if (!signals[0] || !signals[1] || !signals[2] || !signals[3])
                goto out_signals;
 
-       if (noconfig == 0)
-               config = weston_config_parse("weston.ini");
-       if (config != NULL) {
-               weston_log("Using config file '%s'\n",
-                          weston_config_get_full_path(config));
-       } else {
-               weston_log("Starting with no config file.\n");
-       }
+       if (load_configuration(&config, noconfig) < 0)
+               goto out_signals;
+
        section = weston_config_get_section(config, "core", NULL, NULL);
 
        if (!backend) {