]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/mount: remove one more unused temporary variable
authorMike Yuan <me@yhndnzj.com>
Fri, 4 Jul 2025 15:05:38 +0000 (17:05 +0200)
committerMike Yuan <me@yhndnzj.com>
Thu, 9 Oct 2025 16:24:56 +0000 (18:24 +0200)
Similar to 3cea9c403c6d5ff0edb2b8fc99884f2243b1456e,
but for mount_get_what_escaped().

src/core/mount.c

index 801d2195b3237d1f97560dcaf9bd41bec23192a8..edbf7d201ca670dad3ae8b78e6e530f92082d6bf 100644 (file)
@@ -2415,7 +2415,6 @@ char* mount_get_where_escaped(const Mount *m) {
 }
 
 char* mount_get_what_escaped(const Mount *m) {
-        _cleanup_free_ char *escaped = NULL;
         const char *s = NULL;
 
         assert(m);
@@ -2424,14 +2423,10 @@ char* mount_get_what_escaped(const Mount *m) {
                 s = m->parameters_proc_self_mountinfo.what;
         else if (m->from_fragment && m->parameters_fragment.what)
                 s = m->parameters_fragment.what;
+        if (!s)
+                return strdup("");
 
-        if (s) {
-                escaped = utf8_escape_invalid(s);
-                if (!escaped)
-                        return NULL;
-        }
-
-        return escaped ? TAKE_PTR(escaped) : strdup("");
+        return utf8_escape_invalid(s);
 }
 
 char* mount_get_options_escaped(const Mount *m) {