summaryrefslogtreecommitdiff
path: root/src/locale
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-07-27 12:27:28 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-08-03 10:05:10 +0200
commit04499a70fbff3f6b798028473f5c9234a53eaa2d (patch)
treeec7a851e163ee20ba5211c16a86f1c251543e0a7 /src/locale
parentc7cfde640d2b32ff1eb893d1fcd291c25cd421e7 (diff)
downloadsystemd-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/locale')
-rw-r--r--src/locale/keymap-util.c2
-rw-r--r--src/locale/localectl.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c
index d2f0566dbc..d48f0b4216 100644
--- a/src/locale/keymap-util.c
+++ b/src/locale/keymap-util.c
@@ -691,7 +691,7 @@ int find_language_fallback(const char *lang, char **language) {
}
}
- assert_not_reached("should not be here");
+ assert_not_reached();
}
int x11_convert_to_vconsole(Context *c) {
diff --git a/src/locale/localectl.c b/src/locale/localectl.c
index 548ac8eb2c..0de3532f97 100644
--- a/src/locale/localectl.c
+++ b/src/locale/localectl.c
@@ -293,7 +293,7 @@ static int list_x11_keymaps(int argc, char **argv, void *userdata) {
else if (streq(argv[0], "list-x11-keymap-options"))
look_for = OPTIONS;
else
- assert_not_reached("Wrong parameter");
+ assert_not_reached();
for (;;) {
_cleanup_free_ char *line = NULL;
@@ -474,7 +474,7 @@ static int parse_argv(int argc, char *argv[]) {
return -EINVAL;
default:
- assert_not_reached("Unhandled option");
+ assert_not_reached();
}
return 1;