diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-02-08 09:40:24 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-02-08 12:01:16 +0100 |
commit | 502096b56593919fc947415f6e32bcb680728dac (patch) | |
tree | cccf382754374b8b3adedbba4732df1420852a89 | |
parent | 8586e8ab84b46d22ce904a84b6f1c3f798dad24e (diff) | |
download | systemd-502096b56593919fc947415f6e32bcb680728dac.tar.gz |
core/service: constify ExecCommand* in two functions
-rw-r--r-- | src/core/service.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/core/service.c b/src/core/service.c index 9c2fb2ee1c..7513972fb3 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -2691,25 +2691,24 @@ _pure_ static bool service_can_reload(Unit *u) { s->type == SERVICE_NOTIFY_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; |