context: add a helper function to return the default system include path
authorPeter Hutterer <peter.hutterer@who-t.net>
Mon, 30 Sep 2019 05:39:08 +0000 (15:39 +1000)
committerRan Benita <ran234@gmail.com>
Tue, 24 Dec 2019 07:50:03 +0000 (09:50 +0200)
No functional changes but we'll need that same lookup in the rules file
include handling in a future patch.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/context.c
src/context.h

index ff9bcb5..1ab0379 100644 (file)
@@ -69,6 +69,13 @@ err:
     return 0;
 }
 
+const char *
+xkb_context_include_path_get_system_path(struct xkb_context *ctx)
+{
+    const char *root = secure_getenv("XKB_CONFIG_ROOT");
+    return root ? root : DFLT_XKB_CONFIG_ROOT;
+}
+
 /**
  * Append the default include directories to the context.
  */
@@ -106,11 +113,8 @@ xkb_context_include_path_append_default(struct xkb_context *ctx)
         }
     }
 
-    root = secure_getenv("XKB_CONFIG_ROOT");
-    if (root != NULL)
-       ret |= xkb_context_include_path_append(ctx, root);
-    else
-       ret |= xkb_context_include_path_append(ctx, DFLT_XKB_CONFIG_ROOT);
+    root = xkb_context_include_path_get_system_path(ctx);
+    ret |= xkb_context_include_path_append(ctx, root);
 
     return ret;
 }
index 03e6d50..9584dbc 100644 (file)
@@ -59,6 +59,9 @@ const char *
 xkb_context_failed_include_path_get(struct xkb_context *ctx,
                                     unsigned int idx);
 
+const char *
+xkb_context_include_path_get_system_path(struct xkb_context *ctx);
+
 /*
  * Returns XKB_ATOM_NONE if @string was not previously interned,
  * otherwise returns the atom.