1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-11 04:58:19 +03:00

core/service: constify ExecCommand* in two functions

(cherry picked from commit 502096b56593919fc947415f6e32bcb680728dac)
(cherry picked from commit e811aead84ec71926c4b53756a69f75f5b30aaa8)
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2023-02-08 09:40:24 +01:00 committed by Luca Boccassi
parent 158760941f
commit b4df64597b

View File

@ -2626,25 +2626,24 @@ _pure_ static bool service_can_reload(Unit *u) {
return !!s->exec_command[SERVICE_EXEC_RELOAD];
}
static unsigned service_exec_command_index(Unit *u, ServiceExecCommand id, ExecCommand *current) {
static unsigned service_exec_command_index(Unit *u, ServiceExecCommand id, const ExecCommand *current) {
Service *s = SERVICE(u);
unsigned idx = 0;
ExecCommand *first, *c;
assert(s);
assert(id >= 0);
assert(id < _SERVICE_EXEC_COMMAND_MAX);
first = s->exec_command[id];
const ExecCommand *first = s->exec_command[id];
/* Figure out where we are in the list by walking back to the beginning */
for (c = current; c != first; c = c->command_prev)
for (const ExecCommand *c = current; c != first; c = c->command_prev)
idx++;
return idx;
}
static int service_serialize_exec_command(Unit *u, FILE *f, ExecCommand *command) {
static int service_serialize_exec_command(Unit *u, FILE *f, const ExecCommand *command) {
_cleanup_free_ char *args = NULL, *p = NULL;
Service *s = SERVICE(u);
const char *type, *key;