chiark / gitweb /
logind: trivial simplification
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 28 Jan 2017 02:50:06 +0000 (21:50 -0500)
committerSven Eden <yamakuzure@gmx.net>
Mon, 17 Jul 2017 15:58:36 +0000 (17:58 +0200)
free_and_strdup() handles NULL arg, so make use of that.

src/login/logind-dbus.c

index d1eabdb..598b931 100644 (file)
@@ -2464,13 +2464,9 @@ static int method_set_wall_message(
                 return 1; /* Will call us back */
 #endif // 0
 
-        if (isempty(wall_message))
-                m->wall_message = mfree(m->wall_message);
-        else {
-                r = free_and_strdup(&m->wall_message, wall_message);
-                if (r < 0)
-                        return log_oom();
-        }
+        r = free_and_strdup(&m->wall_message, empty_to_null(wall_message));
+        if (r < 0)
+                return log_oom();
 
         m->enable_wall_messages = enable_wall_messages;