diff options
author | Nick Mathewson <nickm@torproject.org> | 2005-04-07 04:50:25 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2005-04-07 04:50:25 +0000 |
commit | a035b8e3c3bdd85c8f04a91c19d990788200764d (patch) | |
tree | a3e90328cf8c429b7cb5e1245a085ee233da4f45 /src | |
parent | b5a962bc2e6381ff0c5e5c405e80e172f02d5ce9 (diff) | |
download | tor-a035b8e3c3bdd85c8f04a91c19d990788200764d.tar.gz tor-a035b8e3c3bdd85c8f04a91c19d990788200764d.zip |
Make compare_orconn_circid_entries marginally faster and inlined, if that helps
svn:r4040
Diffstat (limited to 'src')
-rw-r--r-- | src/or/circuitlist.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/or/circuitlist.c b/src/or/circuitlist.c index c3a3f56507..3fc5dcab6b 100644 --- a/src/or/circuitlist.c +++ b/src/or/circuitlist.c @@ -40,21 +40,18 @@ struct orconn_circid_circuit_map_t { circuit_t *circuit; }; -static int compare_orconn_circid_entries(struct orconn_circid_circuit_map_t *a, - struct orconn_circid_circuit_map_t *b) +static INLINE int compare_orconn_circid_entries( + struct orconn_circid_circuit_map_t *a, + struct orconn_circid_circuit_map_t *b) { if (a->or_conn < b->or_conn) return -1; else if (a->or_conn > b->or_conn) return 1; - else if (a->circ_id < b->circ_id) - return -1; - else if (a->circ_id > b->circ_id) - return 1; else - return 0; + return ((int)b->circ_id) - ((int)a->circ_id); }; -SPLAY_HEAD(orconn_circid_tree, orconn_circid_circuit_map_t) orconn_circid_circuit_map = SPLAY_INITIALIZER(orconn_circid_circuit_map); +static SPLAY_HEAD(orconn_circid_tree, orconn_circid_circuit_map_t) orconn_circid_circuit_map = SPLAY_INITIALIZER(orconn_circid_circuit_map); SPLAY_PROTOTYPE(orconn_circid_tree, orconn_circid_circuit_map_t, node, compare_orconn_circid_entries); SPLAY_GENERATE(orconn_circid_tree, orconn_circid_circuit_map_t, node, compare_orconn_circid_entries); |