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.
This commit is contained in:
@@ -316,7 +316,7 @@ static size_t table_data_size(TableDataType type, const void *data) {
|
||||
return sizeof(mode_t);
|
||||
|
||||
default:
|
||||
assert_not_reached("Uh? Unexpected cell type");
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1048,7 +1048,7 @@ int table_add_many_internal(Table *t, TableDataType first_type, ...) {
|
||||
return 0;
|
||||
|
||||
default:
|
||||
assert_not_reached("Uh? Unexpected data type.");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
r = table_add_cell(t, &last_cell, type, data);
|
||||
@@ -1778,7 +1778,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
|
||||
}
|
||||
|
||||
default:
|
||||
assert_not_reached("Unexpected type?");
|
||||
assert_not_reached();
|
||||
}
|
||||
|
||||
return d->formatted;
|
||||
|
||||
Reference in New Issue
Block a user