]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/mount: remove unused temporary variable
authorMike Yuan <me@yhndnzj.com>
Sun, 6 Apr 2025 22:26:57 +0000 (00:26 +0200)
committerMike Yuan <me@yhndnzj.com>
Fri, 9 May 2025 16:39:37 +0000 (18:39 +0200)
src/core/mount.c

index a831bac697f6e994ea6e79aade6ed29eb73945ab..c496375a212b97eb0e59a9b1bc8234ed5d9e3461 100644 (file)
@@ -2416,7 +2416,6 @@ char* mount_get_what_escaped(const Mount *m) {
 }
 
 char* mount_get_options_escaped(const Mount *m) {
-        _cleanup_free_ char *escaped = NULL;
         const char *s = NULL;
 
         assert(m);
@@ -2425,14 +2424,10 @@ char* mount_get_options_escaped(const Mount *m) {
                 s = m->parameters_proc_self_mountinfo.options;
         else if (m->from_fragment && m->parameters_fragment.options)
                 s = m->parameters_fragment.options;
+        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);
 }
 
 const char* mount_get_fstype(const Mount *m) {