aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_policy.c
diff options
context:
space:
mode:
authorovercaffeinated <overcaffeinated@airmail.cc>2016-10-27 10:26:06 +0100
committerovercaffeinated <overcaffeinated@airmail.cc>2016-10-27 10:26:06 +0100
commit265d5446faf2744569931bc54633684711bbf3ba (patch)
tree80c47c0ef835f971f823d2a472ee188c15979638 /src/test/test_policy.c
parentb8b8b6b70e670cb735b43bc6b90150ab1ed4e2d1 (diff)
downloadtor-265d5446faf2744569931bc54633684711bbf3ba.tar.gz
tor-265d5446faf2744569931bc54633684711bbf3ba.zip
Automated change to use smartlist_add_strdup
Use the following coccinelle script to change uses of smartlist_add(sl, tor_strdup(str)) to smartlist_add_strdup(sl, string) (coccinelle script from nickm via bug 20048): @@ expression a; expression b; @@ - smartlist_add + smartlist_add_strdup (a, - tor_strdup( b - ) )
Diffstat (limited to 'src/test/test_policy.c')
-rw-r--r--src/test/test_policy.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/test_policy.c b/src/test/test_policy.c
index 0d4a3b104f..b89de01b7b 100644
--- a/src/test/test_policy.c
+++ b/src/test/test_policy.c
@@ -525,10 +525,10 @@ test_policies_general(void *arg)
{
char *policy_strng = NULL;
smartlist_t *chunks = smartlist_new();
- smartlist_add(chunks, tor_strdup("accept "));
+ smartlist_add_strdup(chunks, "accept ");
for (i=1; i<10000; ++i)
smartlist_add_asprintf(chunks, "%d,", i);
- smartlist_add(chunks, tor_strdup("20000"));
+ smartlist_add_strdup(chunks, "20000");
policy_strng = smartlist_join_strings(chunks, "", 0, NULL);
SMARTLIST_FOREACH(chunks, char *, ch, tor_free(ch));
smartlist_free(chunks);
@@ -542,9 +542,9 @@ test_policies_general(void *arg)
for (i=1; i<2000; i+=2) {
char buf[POLICY_BUF_LEN];
tor_snprintf(buf, sizeof(buf), "reject *:%d", i);
- smartlist_add(sm, tor_strdup(buf));
+ smartlist_add_strdup(sm, buf);
}
- smartlist_add(sm, tor_strdup("accept *:*"));
+ smartlist_add_strdup(sm, "accept *:*");
policy_str = smartlist_join_strings(sm, ",", 0, NULL);
test_policy_summary_helper( policy_str,
"accept 2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,"