diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-07-27 12:27:28 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-08-03 10:05:10 +0200 |
commit | 04499a70fbff3f6b798028473f5c9234a53eaa2d (patch) | |
tree | ec7a851e163ee20ba5211c16a86f1c251543e0a7 /src/systemctl/systemctl-enable.c | |
parent | c7cfde640d2b32ff1eb893d1fcd291c25cd421e7 (diff) | |
download | systemd-04499a70fbff3f6b798028473f5c9234a53eaa2d.tar.gz |
Drop the text argument from assert_not_reached()
In general we almost never hit those asserts in production code, so users see
them very rarely, if ever. But either way, we just need something that users
can pass to the developers.
We have quite a few of those asserts, and some have fairly nice messages, but
many are like "WTF?" or "???" or "unexpected something". The error that is
printed includes the file location, and function name. In almost all functions
there's at most one assert, so the function name alone is enough to identify
the failure for a developer. So we don't get much extra from the message, and
we might just as well drop them.
Dropping them makes our code a tiny bit smaller, and most importantly, improves
development experience by making it easy to insert such an assert in the code
without thinking how to phrase the argument.
Diffstat (limited to 'src/systemctl/systemctl-enable.c')
-rw-r--r-- | src/systemctl/systemctl-enable.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/systemctl/systemctl-enable.c b/src/systemctl/systemctl-enable.c index 8f053ca649..dcbe2c7302 100644 --- a/src/systemctl/systemctl-enable.c +++ b/src/systemctl/systemctl-enable.c @@ -124,7 +124,7 @@ int enable_unit(int argc, char *argv[], void *userdata) { else if (streq(verb, "revert")) r = unit_file_revert(arg_scope, arg_root, names, &changes, &n_changes); else - assert_not_reached("Unknown verb"); + assert_not_reached(); unit_file_dump_changes(r, verb, changes, n_changes, arg_quiet); if (r < 0) @@ -191,7 +191,7 @@ int enable_unit(int argc, char *argv[], void *userdata) { method = "RevertUnitFiles"; send_runtime = send_force = false; } else - assert_not_reached("Unknown verb"); + assert_not_reached(); r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, method); if (r < 0) |