From ca4ae5068baa710a97c22633e9c12e8bc8cb8be3 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sun, 8 Aug 2021 09:36:31 +0200 Subject: [PATCH] WINGs: Simplify wglobaldefaultspathfordomain The original code was over-complicated, it can be reduced to a one-line call to a function that does the same thing, with the bonus that it will behave better in the case where domain == NULL. --- WINGs/userdefaults.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/WINGs/userdefaults.c b/WINGs/userdefaults.c index f5a56d2d..bc01723c 100644 --- a/WINGs/userdefaults.c +++ b/WINGs/userdefaults.c @@ -113,14 +113,7 @@ char *wdefaultspathfordomain(const char *domain) /* XXX: doesn't quite belong to *user*defaults.c */ char *wglobaldefaultspathfordomain(const char *domain) { - char *t = NULL; - size_t len; - - len = strlen(PKGCONFDIR) + strlen(domain) + 2; - t = wmalloc(len); - snprintf(t, len, "%s/%s", PKGCONFDIR, domain); - - return t; + return wstrconcat(PKGCONFDIR "/", domain); } void w_save_defaults_changes(void)