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:
@@ -2337,9 +2337,8 @@ process_response(NCR_Instance inst, int saved, NTP_Local_Address *local_addr,
|
||||
inst->valid_rx = 1;
|
||||
}
|
||||
|
||||
if ((unsigned int)local_receive.source >= sizeof (tss_chars) ||
|
||||
(unsigned int)local_transmit.source >= sizeof (tss_chars))
|
||||
assert(0);
|
||||
BRIEF_ASSERT((unsigned int)local_receive.source < sizeof (tss_chars) &&
|
||||
(unsigned int)local_transmit.source < sizeof (tss_chars));
|
||||
|
||||
DEBUG_LOG("NTP packet lvm=%o stratum=%d poll=%d prec=%d root_delay=%.9f root_disp=%.9f refid=%"PRIx32" [%s]",
|
||||
message->lvm, message->stratum, message->poll, message->precision,
|
||||
|
||||
Reference in New Issue
Block a user