core: mark unit_*_printf() functions as taking a const Unit*

They should never modify the unit argument, let's make this clear.
Also see 303ee60151.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-10-16 16:21:56 +02:00
parent c8966bffdd
commit a2262bcafa
2 changed files with 4 additions and 5 deletions

View 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):
*

View 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);