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>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
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.