mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 14:45:07 -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:
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "memory.h"
|
||||
#include "siv.h"
|
||||
#include "util.h"
|
||||
|
||||
struct SIV_Instance_Record {
|
||||
SIV_Algorithm algorithm;
|
||||
@@ -158,8 +159,7 @@ SIV_GetMaxNonceLength(SIV_Instance instance)
|
||||
int
|
||||
SIV_GetTagLength(SIV_Instance instance)
|
||||
{
|
||||
if (instance->tag_length < 1 || instance->tag_length > SIV_MAX_TAG_LENGTH)
|
||||
assert(0);
|
||||
BRIEF_ASSERT(instance->tag_length >= 1 && instance->tag_length <= SIV_MAX_TAG_LENGTH);
|
||||
return instance->tag_length;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user