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/journal-remote | |
parent | Merge pull request #20346 from poettering/strlen-unsigned-fix (diff) | |
download | systemd-04499a70fbff3f6b798028473f5c9234a53eaa2d.tar.xz systemd-04499a70fbff3f6b798028473f5c9234a53eaa2d.zip |
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/journal-remote')
-rw-r--r-- | src/journal-remote/journal-gatewayd.c | 2 | ||||
-rw-r--r-- | src/journal-remote/journal-remote-main.c | 2 | ||||
-rw-r--r-- | src/journal-remote/journal-remote.c | 6 | ||||
-rw-r--r-- | src/journal-remote/journal-upload-journal.c | 4 | ||||
-rw-r--r-- | src/journal-remote/journal-upload.c | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index ab1cf7b109..38972fe1a9 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -992,7 +992,7 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; default: - assert_not_reached("Unhandled option"); + assert_not_reached(); } if (optind < argc) diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c index ae1d43756a..140ecac207 100644 --- a/src/journal-remote/journal-remote-main.c +++ b/src/journal-remote/journal-remote-main.c @@ -1003,7 +1003,7 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; default: - assert_not_reached("Unknown option code."); + assert_not_reached(); } if (optind < argc) diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index 6e5aebdc48..9c1ee0188d 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -58,7 +58,7 @@ static int open_output(RemoteServer *s, Writer *w, const char* host) { } default: - assert_not_reached("what?"); + assert_not_reached(); } r = journal_file_open_reliably(filename, @@ -110,7 +110,7 @@ int journal_remote_get_writer(RemoteServer *s, const char *host, Writer **writer break; default: - assert_not_reached("what split mode?"); + assert_not_reached(); } w = hashmap_get(s->writers, key); @@ -323,7 +323,7 @@ int journal_remote_server_init( else if (split_mode == JOURNAL_WRITE_SPLIT_HOST) s->output = REMOTE_JOURNAL_PATH; else - assert_not_reached("bad split mode"); + assert_not_reached(); r = sd_event_default(&s->events); if (r < 0) diff --git a/src/journal-remote/journal-upload-journal.c b/src/journal-remote/journal-upload-journal.c index f23d5cf8b9..899f47eea4 100644 --- a/src/journal-remote/journal-upload-journal.c +++ b/src/journal-remote/journal-upload-journal.c @@ -229,10 +229,10 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) { return pos; default: - assert_not_reached("WTF?"); + assert_not_reached(); } } - assert_not_reached("WTF?"); + assert_not_reached(); } static void check_update_watchdog(Uploader *u) { diff --git a/src/journal-remote/journal-upload.c b/src/journal-remote/journal-upload.c index 2a38d206ea..3c28bbab7a 100644 --- a/src/journal-remote/journal-upload.c +++ b/src/journal-remote/journal-upload.c @@ -779,7 +779,7 @@ static int parse_argv(int argc, char *argv[]) { argv[optind - 1]); default: - assert_not_reached("Unhandled option code."); + assert_not_reached(); } if (!arg_url) |