diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-09-19 22:20:09 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-09-19 22:20:09 +0000 |
commit | 7b0ec744bc8afa691873f97cfb6a3b7822376d7b (patch) | |
tree | 36879b2af44a9c2aabc7906816493d2a6993c692 /src/common/util.c | |
parent | e9abe750ea68099e73064a84dab1e17bbb606c03 (diff) | |
download | tor-7b0ec744bc8afa691873f97cfb6a3b7822376d7b.tar.gz tor-7b0ec744bc8afa691873f97cfb6a3b7822376d7b.zip |
Switch routerlist.c to using memcmp on digests rather than crypto_pk_cmp_keys(); speed up find_whitespace a lot (8x for me) by using a switch statement. This should speed parsing a lot of routers at once by a lot.
svn:r8430
Diffstat (limited to 'src/common/util.c')
-rw-r--r-- | src/common/util.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/common/util.c b/src/common/util.c index 8bd1f2aec0..264bd0b74f 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -434,11 +434,20 @@ const char * find_whitespace(const char *s) { /* tor_assert(s); */ - - while (*s && !TOR_ISSPACE(*s) && *s != '#') - s++; - - return s; + while (1) { + switch (*s) + { + case '\0': + case '#': + case ' ': + case '\r': + case '\n': + case '\t': + return s; + default: + ++s; + } + } } /** Return true iff the 'len' bytes at 'mem' are all zero. */ |