[or-cvs] r13977: Make some assert()s into tor_assert()s. Make some tor_assert (in tor/trunk: . src/common src/or)
nickm at seul.org
nickm at seul.org
Tue Mar 11 18:56:41 UTC 2008
Author: nickm
Date: 2008-03-11 14:56:41 -0400 (Tue, 11 Mar 2008)
New Revision: 13977
Modified:
tor/trunk/
tor/trunk/src/common/aes.c
tor/trunk/src/common/log.c
tor/trunk/src/or/config.c
tor/trunk/src/or/connection.c
Log:
r18753 at 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.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r18753] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/src/common/aes.c
===================================================================
--- tor/trunk/src/common/aes.c 2008-03-11 18:36:41 UTC (rev 13976)
+++ tor/trunk/src/common/aes.c 2008-03-11 18:56:41 UTC (rev 13977)
@@ -265,7 +265,7 @@
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
Modified: tor/trunk/src/common/log.c
===================================================================
--- tor/trunk/src/common/log.c 2008-03-11 18:36:41 UTC (rev 13976)
+++ tor/trunk/src/common/log.c 2008-03-11 18:56:41 UTC (rev 13977)
@@ -57,7 +57,9 @@
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 @@
/* 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 @@
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 @@
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;
Modified: tor/trunk/src/or/config.c
===================================================================
--- tor/trunk/src/or/config.c 2008-03-11 18:36:41 UTC (rev 13976)
+++ tor/trunk/src/or/config.c 2008-03-11 18:56:41 UTC (rev 13977)
@@ -3718,7 +3718,7 @@
config_line_t *cl;
int retval;
int err = -1;
- assert(msg);
+ tor_assert(msg);
oldoptions = global_options; /* get_options unfortunately asserts if
this is the first time we run*/
Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c 2008-03-11 18:36:41 UTC (rev 13976)
+++ tor/trunk/src/or/connection.c 2008-03-11 18:56:41 UTC (rev 13977)
@@ -734,7 +734,7 @@
(void)readable_address;
log_fn(LOG_ERR, LD_BUG,
"Unix domain sockets not supported, yet we tried to create one.");
- assert(0);
+ tor_assert(0);
};
#endif /* HAVE_SYS_UN_H */
More information about the tor-commits
mailing list