]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: mark unit_*_printf() functions as taking a const Unit*
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 16 Oct 2019 14:21:56 +0000 (16:21 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 16 Oct 2019 14:21:56 +0000 (16:21 +0200)
They should never modify the unit argument, let's make this clear.
Also see 303ee60151.

src/core/unit-printf.c
src/core/unit-printf.h

index ffa12d8a929f1ac27d61b306b9bba9395fc05e1b..2daaaf997175c142c865d81a649bf28578e8889d 100644 (file)
@@ -171,7 +171,7 @@ static int specifier_special_directory(char specifier, const void *data, const v
         return 0;
 }
 
-int unit_name_printf(Unit *u, const char* format, char **ret) {
+int unit_name_printf(const Unit *u, const char* format, char **ret) {
 
         /*
          * This will use the passed string as format string and replace the following specifiers (which should all be
@@ -215,8 +215,7 @@ int unit_name_printf(Unit *u, const char* format, char **ret) {
         return specifier_printf(format, table, u, ret);
 }
 
-int unit_full_printf(Unit *u, const char *format, char **ret) {
-
+int unit_full_printf(const Unit *u, const char *format, char **ret) {
         /* This is similar to unit_name_printf() but also supports unescaping. Also, adds a couple of additional codes
          * (which are likely not suitable for unescaped inclusion in unit names):
          *
index f3dae159d5328cc7f075f602881a996c1103d6e5..cb75448ae5c83a87b758ea513b09ce3153b46207 100644 (file)
@@ -3,5 +3,5 @@
 
 #include "unit.h"
 
-int unit_name_printf(Unit *u, const char* text, char **ret);
-int unit_full_printf(Unit *u, const char *text, char **ret);
+int unit_name_printf(const Unit *u, const char* text, char **ret);
+int unit_full_printf(const Unit *u, const char *text, char **ret);