mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 19:15: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:
@@ -663,8 +663,7 @@ create_credentials(const char **certs, const char **keys, int n_certs_keys,
|
||||
goto error;
|
||||
|
||||
if (certs && keys) {
|
||||
if (trusted_certs || trusted_certs_ids)
|
||||
assert(0);
|
||||
BRIEF_ASSERT(!trusted_certs && !trusted_certs_ids);
|
||||
|
||||
for (i = 0; i < n_certs_keys; i++) {
|
||||
if (!UTI_CheckFilePermissions(keys[i], 0771))
|
||||
@@ -675,8 +674,7 @@ create_credentials(const char **certs, const char **keys, int n_certs_keys,
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
if (certs || keys || n_certs_keys > 0)
|
||||
assert(0);
|
||||
BRIEF_ASSERT(!certs && !keys && n_certs_keys <= 0);
|
||||
|
||||
if (trusted_cert_set == 0 && !CNF_GetNoSystemCert()) {
|
||||
r = gnutls_certificate_set_x509_system_trust(credentials);
|
||||
|
||||
Reference in New Issue
Block a user