chiark / gitweb /
tree-wide: remove useless NULLs from strjoina
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 9 Apr 2016 18:04:09 +0000 (14:04 -0400)
committerSven Eden <yamakuzure@gmx.net>
Fri, 16 Jun 2017 08:12:57 +0000 (10:12 +0200)
The coccinelle patch didn't work in some places, I have no idea why.

coccinelle/strjoina.cocci [new file with mode: 0644]
src/login/logind-session.c
src/shared/bus-util.c

diff --git a/coccinelle/strjoina.cocci b/coccinelle/strjoina.cocci
new file mode 100644 (file)
index 0000000..a6236eb
--- /dev/null
@@ -0,0 +1,6 @@
+@@
+expression n, m;
+expression list s;
+@@
+- n = strjoina(m, s, NULL);
++ n = strjoina(m, s);
index ff2c95c55d60c3192bbbd36690dd2a1af773bcc0..e615ccd312a9f2399500863768d0559a7245ba14 100644 (file)
@@ -520,7 +520,7 @@ static int session_start_scope(Session *s) {
                 if (!scope)
                         return log_oom();
 
-                description = strjoina("Session ", s->id, " of user ", s->user->name, NULL);
+                description = strjoina("Session ", s->id, " of user ", s->user->name);
 
                 r = manager_start_scope(
                                 s->manager,
index 94872a31c4603377f707fd9d6967dcb1c1380d74..c8092e0e586f3619704d841452ba04854efd70eb 100644 (file)
@@ -2053,8 +2053,8 @@ static void log_job_error_with_service_result(const char* service, const char *r
                 _cleanup_free_ char *t;
 
                 t = strv_join((char**) extra_args, " ");
-                systemctl = strjoina("systemctl ", t ?: "<args>", NULL);
-                journalctl = strjoina("journalctl ", t ?: "<args>", NULL);
+                systemctl = strjoina("systemctl ", t ? : "<args>");
+                journalctl = strjoina("journalctl ", t ? : "<args>");
         }
 
         if (!isempty(result)) {