Commit 67b538ddc0459732ddb9ef0961994ba3ae7c5cda

Peter Hutterer 2019-09-30T15:39:08

context: add a helper function to return the default system include path 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>

diff --git a/src/context.c b/src/context.c
index ff9bcb5..1ab0379 100644
--- a/src/context.c
+++ b/src/context.c
@@ -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;
 }
diff --git a/src/context.h b/src/context.h
index 03e6d50..9584dbc 100644
--- a/src/context.h
+++ b/src/context.h
@@ -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.