From 8f307178df4e7fc4f78d34e9875b8d69b97ea220 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 31 Jul 2021 00:39:51 +0200 Subject: config: include: use xasprintf() instead of two calls to snprintf() --- config.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'config.c') diff --git a/config.c b/config.c index 2c76ffa5..f57129a7 100644 --- a/config.c +++ b/config.c @@ -657,9 +657,7 @@ parse_section_main(const char *key, const char *value, struct config *conf, return false; } - int chars = snprintf(NULL, 0, "%s/%s", home_dir, &value[2]); - _include_path = malloc(chars + 1); - snprintf(_include_path, chars + 1, "%s/%s", home_dir, &value[2]); + _include_path = xasprintf("%s/%s", home_dir, value + 2); include_path = _include_path; } else include_path = value; -- cgit v1.3