Commit 7d1aefddada5cceeb5a6a5d93093740d1bff985a

Peter Hutterer 2020-06-22T13:01:41

test: simplify an exit path The unref() functions take NULL as argument, so we don't need different labels for every possible exit path. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>

diff --git a/test/print-compiled-keymap.c b/test/print-compiled-keymap.c
index 64c1915..bda33fd 100644
--- a/test/print-compiled-keymap.c
+++ b/test/print-compiled-keymap.c
@@ -32,8 +32,8 @@ main(int argc, char *argv[])
 {
     int ret = EXIT_FAILURE;
     int opt;
-    struct xkb_context *ctx;
-    struct xkb_keymap *keymap;
+    struct xkb_context *ctx = NULL;
+    struct xkb_keymap *keymap = NULL;
     const char *keymap_path = NULL;
     char *dump;
 
@@ -56,29 +56,27 @@ main(int argc, char *argv[])
     ctx = test_get_context(0);
     if (!ctx) {
         fprintf(stderr, "Couldn't create xkb context\n");
-        goto err_out;
+        goto out;
     }
 
     keymap = test_compile_file(ctx, keymap_path);
     if (!keymap) {
         fprintf(stderr, "Couldn't create xkb keymap\n");
-        goto err_ctx;
+        goto out;
     }
 
     dump = xkb_keymap_get_as_string(keymap, XKB_KEYMAP_FORMAT_TEXT_V1);
     if (!dump) {
         fprintf(stderr, "Couldn't get the keymap string\n");
-        goto err_map;
+        goto out;
     }
 
     fputs(dump, stdout);
 
     ret = EXIT_SUCCESS;
     free(dump);
-err_map:
+out:
     xkb_keymap_unref(keymap);
-err_ctx:
     xkb_context_unref(ctx);
-err_out:
     return ret;
 }