xkbcomp: move the logging of include paths into a helper function No functional changes, prep work for some other refacturing. 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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
diff --git a/src/xkbcomp/include.c b/src/xkbcomp/include.c
index cf90384..ac2279f 100644
--- a/src/xkbcomp/include.c
+++ b/src/xkbcomp/include.c
@@ -195,6 +195,31 @@ DirectoryForInclude(enum xkb_file_type type)
return xkb_file_type_include_dirs[type];
}
+static void
+LogIncludePaths(struct xkb_context *ctx)
+{
+ unsigned int i;
+
+ if (xkb_context_num_include_paths(ctx) > 0) {
+ log_err(ctx, "%d include paths searched:\n",
+ xkb_context_num_include_paths(ctx));
+ for (i = 0; i < xkb_context_num_include_paths(ctx); i++)
+ log_err(ctx, "\t%s\n",
+ xkb_context_include_path_get(ctx, i));
+ }
+ else {
+ log_err(ctx, "There are no include paths to search\n");
+ }
+
+ if (xkb_context_num_failed_include_paths(ctx) > 0) {
+ log_err(ctx, "%d include paths could not be added:\n",
+ xkb_context_num_failed_include_paths(ctx));
+ for (i = 0; i < xkb_context_num_failed_include_paths(ctx); i++)
+ log_err(ctx, "\t%s\n",
+ xkb_context_failed_include_path_get(ctx, i));
+ }
+}
+
FILE *
FindFileInXkbPath(struct xkb_context *ctx, const char *name,
enum xkb_file_type type, char **pathRtrn)
@@ -228,24 +253,7 @@ FindFileInXkbPath(struct xkb_context *ctx, const char *name,
log_err(ctx, "Couldn't find file \"%s/%s\" in include paths\n",
typeDir, name);
- if (xkb_context_num_include_paths(ctx) > 0) {
- log_err(ctx, "%d include paths searched:\n",
- xkb_context_num_include_paths(ctx));
- for (i = 0; i < xkb_context_num_include_paths(ctx); i++)
- log_err(ctx, "\t%s\n",
- xkb_context_include_path_get(ctx, i));
- }
- else {
- log_err(ctx, "There are no include paths to search\n");
- }
-
- if (xkb_context_num_failed_include_paths(ctx) > 0) {
- log_err(ctx, "%d include paths could not be added:\n",
- xkb_context_num_failed_include_paths(ctx));
- for (i = 0; i < xkb_context_num_failed_include_paths(ctx); i++)
- log_err(ctx, "\t%s\n",
- xkb_context_failed_include_path_get(ctx, i));
- }
+ LogIncludePaths(ctx);
free(buf);
return NULL;