mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:35:06 -05:00
rewrite some assertions for better readability
Some assertions are written as "if (x) assert(0)" to avoid having the text of a long argument compiled in the binary. Rewrite them to use a new BRIEF_ASSERT macro to make the condition easier to read in its non-negated form and make it easier to turn it back to the full-text assert if needed.
This commit is contained in:
3
client.c
3
client.c
@@ -946,8 +946,7 @@ process_cmd_add_source(CMD_Request *msg, char *line)
|
||||
}
|
||||
|
||||
msg->data.ntp_source.type = htonl(type);
|
||||
if (strlen(data.name) >= sizeof (msg->data.ntp_source.name))
|
||||
assert(0);
|
||||
BRIEF_ASSERT(strlen(data.name) < sizeof (msg->data.ntp_source.name));
|
||||
strncpy((char *)msg->data.ntp_source.name, data.name,
|
||||
sizeof (msg->data.ntp_source.name));
|
||||
msg->data.ntp_source.port = htonl(data.port);
|
||||
|
||||
Reference in New Issue
Block a user