summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2020-07-27 11:55:32 +1000
committerRan Benita <ran@unusedvar.com>2020-08-30 21:49:41 +0300
commitbbc7005b2a6509e0723b57f54718ca4a3dc7b99b (patch)
tree0a6eb5d5bf215b159d370d06215f3a77f994680b /src
parent351b4b9c0bd8844ff9d408be2adee2b4b095fb06 (diff)
downloadxorg-lib-libxkbcommon-bbc7005b2a6509e0723b57f54718ca4a3dc7b99b.tar.gz
xkbcomp: simplify the include path handling
Streamline the code a bit - instead of handling all the if (!file) conditions handle the case of where we have a file and jump to the end. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/xkbcomp/include.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/xkbcomp/include.c b/src/xkbcomp/include.c
index ac2279f..88feab3 100644
--- a/src/xkbcomp/include.c
+++ b/src/xkbcomp/include.c
@@ -241,28 +241,21 @@ FindFileInXkbPath(struct xkb_context *ctx, const char *name,
}
file = fopen(buf, "rb");
- if (!file) {
- free(buf);
- buf = NULL;
- } else {
- break;
+ if (file) {
+ if (pathRtrn) {
+ *pathRtrn = buf;
+ buf = NULL;
+ }
+ goto out;
}
}
- if (!file) {
- log_err(ctx, "Couldn't find file \"%s/%s\" in include paths\n",
- typeDir, name);
+ log_err(ctx, "Couldn't find file \"%s/%s\" in include paths\n",
+ typeDir, name);
+ LogIncludePaths(ctx);
- LogIncludePaths(ctx);
-
- free(buf);
- return NULL;
- }
-
- if (pathRtrn)
- *pathRtrn = buf;
- else
- free(buf);
+out:
+ free(buf);
return file;
}