From: Yu Watanabe Date: Fri, 11 Apr 2025 01:04:06 +0000 (+0900) Subject: locale-util: use string_hash_ops_free and set_to_strv() X-Git-Tag: v258-rc1~829^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=21d84e8905766ad7d33d5a189ae944dd06ab5257;p=thirdparty%2Fsystemd.git locale-util: use string_hash_ops_free and set_to_strv() Then we can drop hackish combination of use of set_free_free() and set_free(). --- diff --git a/src/basic/locale-util.c b/src/basic/locale-util.c index 2e4609b7fc4..2fbab01aebd 100644 --- a/src/basic/locale-util.c +++ b/src/basic/locale-util.c @@ -188,10 +188,10 @@ static int add_locales_from_libdir(Set *locales) { } int get_locales(char ***ret) { - _cleanup_set_free_free_ Set *locales = NULL; + _cleanup_set_free_ Set *locales = NULL; int r; - locales = set_new(&string_hash_ops); + locales = set_new(&string_hash_ops_free); if (!locales) return -ENOMEM; @@ -212,13 +212,10 @@ int get_locales(char ***ret) { free(set_remove(locales, locale)); } - _cleanup_strv_free_ char **l = set_get_strv(locales); + _cleanup_strv_free_ char **l = set_to_strv(&locales); if (!l) return -ENOMEM; - /* Now, all elements are owned by strv 'l'. Hence, do not call set_free_free(). */ - locales = set_free(locales); - r = getenv_bool("SYSTEMD_LIST_NON_UTF8_LOCALES"); if (r <= 0) { if (!IN_SET(r, -ENXIO, 0))