Aftermath of isin->contains renaming

Fix wide lines and comments, and add a changes file
This commit is contained in:
Nick Mathewson 2012-04-11 12:59:57 -04:00
parent 49e619c1cf
commit ca18768fb2
6 changed files with 12 additions and 6 deletions

2
changes/rename5285 Normal file
View File

@ -0,0 +1,2 @@
o Code simplifications and refactoring:
- Rename "isin" functions to "contains", for grammar. Fixes ticket 5285.

View File

@ -804,7 +804,8 @@ circuit_stream_is_being_handled(entry_connection_t *conn,
const node_t *exitnode; const node_t *exitnode;
int num=0; int num=0;
time_t now = time(NULL); time_t now = time(NULL);
int need_uptime = smartlist_contains_int_as_string(get_options()->LongLivedPorts, int need_uptime = smartlist_contains_int_as_string(
get_options()->LongLivedPorts,
conn ? conn->socks_request->port : port); conn ? conn->socks_request->port : port);
for (circ=global_circuitlist;circ;circ = circ->next) { for (circ=global_circuitlist;circ;circ = circ->next) {

View File

@ -829,7 +829,8 @@ static int
consider_plaintext_ports(entry_connection_t *conn, uint16_t port) consider_plaintext_ports(entry_connection_t *conn, uint16_t port)
{ {
const or_options_t *options = get_options(); const or_options_t *options = get_options();
int reject = smartlist_contains_int_as_string(options->RejectPlaintextPorts, port); int reject = smartlist_contains_int_as_string(
options->RejectPlaintextPorts, port);
if (smartlist_contains_int_as_string(options->WarnPlaintextPorts, port)) { if (smartlist_contains_int_as_string(options->WarnPlaintextPorts, port)) {
log_warn(LD_APP, "Application request to port %d: this port is " log_warn(LD_APP, "Application request to port %d: this port is "

View File

@ -1866,7 +1866,8 @@ add_wildcarded_test_address(const char *address)
if (!dns_wildcarded_test_address_list) if (!dns_wildcarded_test_address_list)
dns_wildcarded_test_address_list = smartlist_new(); dns_wildcarded_test_address_list = smartlist_new();
if (smartlist_contains_string_case(dns_wildcarded_test_address_list, address)) if (smartlist_contains_string_case(dns_wildcarded_test_address_list,
address))
return; return;
n_test_addrs = get_options()->ServerDNSTestAddresses ? n_test_addrs = get_options()->ServerDNSTestAddresses ?

View File

@ -2809,7 +2809,8 @@ directory_post_to_hs_dir(rend_service_descriptor_t *renddesc,
hs_dir->or_port); hs_dir->or_port);
tor_free(hs_dir_ip); tor_free(hs_dir_ip);
/* Remember successful upload to this router for next time. */ /* Remember successful upload to this router for next time. */
if (!smartlist_contains_digest(successful_uploads, hs_dir->identity_digest)) if (!smartlist_contains_digest(successful_uploads,
hs_dir->identity_digest))
smartlist_add(successful_uploads, hs_dir->identity_digest); smartlist_add(successful_uploads, hs_dir->identity_digest);
} }
smartlist_clear(responsible_dirs); smartlist_clear(responsible_dirs);

View File

@ -278,7 +278,7 @@ test_container_smartlist_strings(void)
test_streq(cp_alloc, "50,a,canal,man,noon,panama,plan,radar"); test_streq(cp_alloc, "50,a,canal,man,noon,panama,plan,radar");
tor_free(cp_alloc); tor_free(cp_alloc);
/* Test string_isin and isin_case and num_isin */ /* Test contains_string, contains_string_case and contains_int_as_string */
test_assert(smartlist_contains_string(sl, "noon")); test_assert(smartlist_contains_string(sl, "noon"));
test_assert(!smartlist_contains_string(sl, "noonoon")); test_assert(!smartlist_contains_string(sl, "noonoon"));
test_assert(smartlist_contains_string_case(sl, "nOOn")); test_assert(smartlist_contains_string_case(sl, "nOOn"));
@ -389,7 +389,7 @@ test_container_smartlist_digests(void)
{ {
smartlist_t *sl = smartlist_new(); smartlist_t *sl = smartlist_new();
/* digest_isin. */ /* contains_digest */
smartlist_add(sl, tor_memdup("AAAAAAAAAAAAAAAAAAAA", DIGEST_LEN)); smartlist_add(sl, tor_memdup("AAAAAAAAAAAAAAAAAAAA", DIGEST_LEN));
smartlist_add(sl, tor_memdup("\00090AAB2AAAAaasdAAAAA", DIGEST_LEN)); smartlist_add(sl, tor_memdup("\00090AAB2AAAAaasdAAAAA", DIGEST_LEN));
smartlist_add(sl, tor_memdup("\00090AAB2AAAAaasdAAAAA", DIGEST_LEN)); smartlist_add(sl, tor_memdup("\00090AAB2AAAAaasdAAAAA", DIGEST_LEN));