aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorCraig Barnes <craigbarnes@protonmail.com>2024-08-03 07:12:13 +0000
committerCraig Barnes <craigbarnes@protonmail.com>2024-08-03 07:51:06 +0000
commitf87c9bb9f70f1a6c8c7081c762c15ba7eaaf971e (patch)
treeaa30277b7b180ec4af22163aebf63686fc93e0be /config.c
parentchangelog: add new 'unreleased' section (diff)
xmalloc: remove delim param from xstrjoin() and add separate xstrjoin3()
This avoids the need for an unused third argument for most xstrjoin() calls and replaces the cases where it's needed with a more flexible function. Code generation is the same in both cases, when there are 2 string params and a compile-time known delimiter. This commit also converts 4 uses of xasprintf() to use xstrjoin*(). See also: https://godbolt.org/z/xsjrhv9b6
Diffstat (limited to 'config.c')
-rw-r--r--config.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/config.c b/config.c
index 46b3d2d2..bf3c4175 100644
--- a/config.c
+++ b/config.c
@@ -356,9 +356,9 @@ open_config(void)
/* First, check XDG_CONFIG_HOME (or .config, if unset) */
if (xdg_config_home != NULL && xdg_config_home[0] != '\0')
- path = xstrjoin(xdg_config_home, "/foot/foot.ini", 0);
+ path = xstrjoin(xdg_config_home, "/foot/foot.ini");
else if (home_dir != NULL)
- path = xstrjoin(home_dir, "/.config/foot/foot.ini", 0);
+ path = xstrjoin(home_dir, "/.config/foot/foot.ini");
if (path != NULL) {
LOG_DBG("checking for %s", path);
@@ -383,7 +383,7 @@ open_config(void)
conf_dir = strtok(NULL, ":"))
{
free(path);
- path = xstrjoin(conf_dir, "/foot/foot.ini", 0);
+ path = xstrjoin(conf_dir, "/foot/foot.ini");
LOG_DBG("checking for %s", path);
int fd = open(path, O_RDONLY | O_CLOEXEC);
@@ -843,7 +843,7 @@ parse_section_main(struct context *ctx)
return false;
}
- _include_path = xasprintf("%s/%s", home_dir, value + 2);
+ _include_path = xstrjoin3(home_dir, "/", value + 2);
include_path = _include_path;
} else
include_path = value;
@@ -2931,7 +2931,7 @@ get_server_socket_path(void)
const char *wayland_display = getenv("WAYLAND_DISPLAY");
if (wayland_display == NULL) {
- return xstrjoin(xdg_runtime, "/foot.sock", 0);
+ return xstrjoin(xdg_runtime, "/foot.sock");
}
return xasprintf("%s/foot-%s.sock", xdg_runtime, wayland_display);