aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-03-11 18:56:41 +0000
committerNick Mathewson <nickm@torproject.org>2008-03-11 18:56:41 +0000
commit11e464c3312cb2813ce326fd83ea88364edb0f4a (patch)
treea83fd52d435ab9e166893b8870d8d8f76595b87f /src/common
parent4d32c2e81f25668bc74fc879c2be62f018690b4e (diff)
downloadtor-11e464c3312cb2813ce326fd83ea88364edb0f4a.tar
tor-11e464c3312cb2813ce326fd83ea88364edb0f4a.tar.gz
r18753@catbus: nickm | 2008-03-11 14:56:39 -0400
Make some assert()s into tor_assert()s. Make some tor_assert()s called from logging into assert()s, and document why. svn:r13977
Diffstat (limited to 'src/common')
-rw-r--r--src/common/aes.c2
-rw-r--r--src/common/log.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/src/common/aes.c b/src/common/aes.c
index 3a17af7f3..52b28b24a 100644
--- a/src/common/aes.c
+++ b/src/common/aes.c
@@ -265,7 +265,7 @@ aes_set_key(aes_cnt_cipher_t *cipher, const char *key, int key_bits)
void
aes_free_cipher(aes_cnt_cipher_t *cipher)
{
- assert(cipher);
+ tor_assert(cipher);
#ifdef USE_OPENSSL_EVP
EVP_CIPHER_CTX_cleanup(&cipher->key);
#endif
diff --git a/src/common/log.c b/src/common/log.c
index 80f413c0a..1f541d976 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -57,7 +57,9 @@ sev_to_string(int severity)
case LOG_NOTICE: return "notice";
case LOG_WARN: return "warn";
case LOG_ERR: return "err";
- default: assert(0); return "UNKNOWN";
+ default: /* Call assert, not tor_assert, since tor_assert
+ * calls log on failure. */
+ assert(0); return "UNKNOWN";
}
}
@@ -76,6 +78,7 @@ should_log_function_name(log_domain_mask_t domain, int severity)
/* We care about places where bugs occur. */
return (domain == LD_BUG);
default:
+ /* Call assert, not tor_assert, since tor_assert calls log on failure. */
assert(0); return 0;
}
}
@@ -203,7 +206,7 @@ format_msg(char *buf, size_t buf_len,
int r;
char *end_of_prefix;
- tor_assert(buf_len >= 2); /* prevent integer underflow */
+ assert(buf_len >= 2); /* prevent integer underflow */
buf_len -= 2; /* subtract 2 characters so we have room for \n\0 */
n = _log_prefix(buf, buf_len, severity);
@@ -256,6 +259,7 @@ logv(int severity, log_domain_mask_t domain, const char *funcname,
logfile_t *lf;
char *end_of_prefix=NULL;
+ /* Call assert, not tor_assert, since tor_assert calls log on failure. */
assert(format);
LOCK_LOGS();
lf = logfiles;