[tor-commits] [tor/master] clean up eol whitespace from coccinelle-generated patches

nickm at torproject.org nickm at torproject.org
Wed Sep 17 14:31:22 UTC 2014


commit ea72b4f60a6a224b0da53c4c95b5dbf2c4d4cd57
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Sep 16 09:40:38 2014 -0400

    clean up eol whitespace from coccinelle-generated patches
---
 src/test/test.c            |    3 +-
 src/test/test_addr.c       |    3 +-
 src/test/test_containers.c |   21 +++++-----
 src/test/test_crypto.c     |   24 +++++++----
 src/test/test_dir.c        |    3 +-
 src/test/test_util.c       |   96 +++++++++++++++++++++++++++++---------------
 6 files changed, 96 insertions(+), 54 deletions(-)

diff --git a/src/test/test.c b/src/test/test.c
index 220484a..cfbe203 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -693,7 +693,8 @@ test_rend_fns(void *arg)
   tt_assert(rend_compute_v2_desc_id(computed_desc_id, service_id_base32,
                                       NULL, now, 0) == 0);
   tt_mem_op(((rend_encoded_v2_service_descriptor_t *)
-             smartlist_get(descs, 0))->desc_id,==, computed_desc_id, DIGEST_LEN);
+             smartlist_get(descs, 0))->desc_id, ==,
+            computed_desc_id, DIGEST_LEN);
   tt_assert(rend_parse_v2_service_descriptor(&parsed, parsed_desc_id,
                                                &intro_points_encrypted,
                                                &intro_points_size,
diff --git a/src/test/test_addr.c b/src/test/test_addr.c
index 28860f6..043c2a0 100644
--- a/src/test/test_addr.c
+++ b/src/test/test_addr.c
@@ -157,7 +157,8 @@ test_addr_basic(void *arg)
     t1.family = t2.family = AF_INET6;                             \
     r = tor_addr_compare_masked(&t1,&t2,m,CMP_SEMANTIC);          \
     if (!(r op 0))                                                \
-      TT_DIE(("Failed: tor_addr_compare_masked(%s,%s,%d) %s 0", a, b, m, #op)); \
+      TT_DIE(("Failed: tor_addr_compare_masked(%s,%s,%d) %s 0", \
+              a, b, m, #op));                                   \
   STMT_END
 
 /** Helper: assert that <b>xx</b> is parseable as a masked IPv6 address with
diff --git a/src/test/test_containers.c b/src/test/test_containers.c
index 21811b9..24211dd 100644
--- a/src/test/test_containers.c
+++ b/src/test/test_containers.c
@@ -29,7 +29,7 @@ compare_strs_for_bsearch_(const void *a, const void **b)
 /** Helper: return a tristate based on comparing the strings in *<b>a</b> and
  * *<b>b</b>, excluding a's first character, and ignoring case. */
 static int
-compare_without_first_ch_(const void *a, const void **b)
+cmp_without_first_(const void *a, const void **b)
 {
   const char *s1 = a, *s2 = *b;
   return strcasecmp(s1+1, s2);
@@ -225,26 +225,27 @@ test_container_smartlist_strings(void *arg)
   /* Test bsearch. */
   smartlist_sort(sl, compare_strs_);
   tt_str_op("nickm",==, smartlist_bsearch(sl, "zNicKM",
-                                        compare_without_first_ch_));
-  tt_str_op("and",==, smartlist_bsearch(sl, " AND", compare_without_first_ch_));
-  tt_ptr_op(NULL,==, smartlist_bsearch(sl, " ANz", compare_without_first_ch_));
+                                        cmp_without_first_));
+  tt_str_op("and",==,
+            smartlist_bsearch(sl, " AND", cmp_without_first_));
+  tt_ptr_op(NULL,==, smartlist_bsearch(sl, " ANz", cmp_without_first_));
 
   /* Test bsearch_idx */
   {
     int f;
     smartlist_t *tmp = NULL;
 
-    tt_int_op(0,==, smartlist_bsearch_idx(sl," aaa",compare_without_first_ch_,&f));
+    tt_int_op(0,==,smartlist_bsearch_idx(sl," aaa",cmp_without_first_,&f));
     tt_int_op(f,==, 0);
-    tt_int_op(0,==, smartlist_bsearch_idx(sl," and",compare_without_first_ch_,&f));
+    tt_int_op(0,==, smartlist_bsearch_idx(sl," and",cmp_without_first_,&f));
     tt_int_op(f,==, 1);
-    tt_int_op(1,==, smartlist_bsearch_idx(sl," arm",compare_without_first_ch_,&f));
+    tt_int_op(1,==, smartlist_bsearch_idx(sl," arm",cmp_without_first_,&f));
     tt_int_op(f,==, 0);
-    tt_int_op(1,==, smartlist_bsearch_idx(sl," arma",compare_without_first_ch_,&f));
+    tt_int_op(1,==, smartlist_bsearch_idx(sl," arma",cmp_without_first_,&f));
     tt_int_op(f,==, 1);
-    tt_int_op(2,==, smartlist_bsearch_idx(sl," armb",compare_without_first_ch_,&f));
+    tt_int_op(2,==, smartlist_bsearch_idx(sl," armb",cmp_without_first_,&f));
     tt_int_op(f,==, 0);
-    tt_int_op(7,==, smartlist_bsearch_idx(sl," zzzz",compare_without_first_ch_,&f));
+    tt_int_op(7,==, smartlist_bsearch_idx(sl," zzzz",cmp_without_first_,&f));
     tt_int_op(f,==, 0);
 
     /* Test trivial cases for list of length 0 or 1 */
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index c765b29..86b77a6 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -430,19 +430,23 @@ test_crypto_pk(void *arg)
                                         PK_PKCS1_OAEP_PADDING));
   /* oaep padding should make encryption not match */
   tt_mem_op(data1,!=, data2, 128);
-  tt_int_op(15,==, crypto_pk_private_decrypt(pk1, data3, sizeof(data3), data1, 128,
+  tt_int_op(15,==,
+            crypto_pk_private_decrypt(pk1, data3, sizeof(data3), data1, 128,
                                         PK_PKCS1_OAEP_PADDING,1));
   tt_str_op(data3,==, "Hello whirled.");
   memset(data3, 0, 1024);
-  tt_int_op(15,==, crypto_pk_private_decrypt(pk1, data3, sizeof(data3), data2, 128,
+  tt_int_op(15,==,
+            crypto_pk_private_decrypt(pk1, data3, sizeof(data3), data2, 128,
                                         PK_PKCS1_OAEP_PADDING,1));
   tt_str_op(data3,==, "Hello whirled.");
   /* Can't decrypt with public key. */
-  tt_int_op(-1,==, crypto_pk_private_decrypt(pk2, data3, sizeof(data3), data2, 128,
+  tt_int_op(-1,==,
+            crypto_pk_private_decrypt(pk2, data3, sizeof(data3), data2, 128,
                                         PK_PKCS1_OAEP_PADDING,1));
   /* Try again with bad padding */
   memcpy(data2+1, "XYZZY", 5);  /* This has fails ~ once-in-2^40 */
-  tt_int_op(-1,==, crypto_pk_private_decrypt(pk1, data3, sizeof(data3), data2, 128,
+  tt_int_op(-1,==,
+            crypto_pk_private_decrypt(pk1, data3, sizeof(data3), data2, 128,
                                         PK_PKCS1_OAEP_PADDING,1));
 
   /* File operations: save and load private key */
@@ -457,12 +461,14 @@ test_crypto_pk(void *arg)
                                                    get_fname("xyzzy")) < 0);
   tt_assert(! crypto_pk_read_private_key_from_filename(pk2,
                                                          get_fname("pkey1")));
-  tt_int_op(15,==, crypto_pk_private_decrypt(pk2, data3, sizeof(data3), data1, 128,
+  tt_int_op(15,==,
+            crypto_pk_private_decrypt(pk2, data3, sizeof(data3), data1, 128,
                                         PK_PKCS1_OAEP_PADDING,1));
 
   /* Now try signing. */
   strlcpy(data1, "Ossifrage", 1024);
-  tt_int_op(128,==, crypto_pk_private_sign(pk1, data2, sizeof(data2), data1, 10));
+  tt_int_op(128,==,
+            crypto_pk_private_sign(pk1, data2, sizeof(data2), data1, 10));
   tt_int_op(10,==,
           crypto_pk_public_checksig(pk1, data3, sizeof(data3), data2, 128));
   tt_str_op(data3,==, "Ossifrage");
@@ -471,8 +477,10 @@ test_crypto_pk(void *arg)
                                              data1, 10));
   tt_int_op(20,==,
           crypto_pk_public_checksig(pk1, data3, sizeof(data3), data2, 128));
-  tt_int_op(0,==, crypto_pk_public_checksig_digest(pk1, data1, 10, data2, 128));
-  tt_int_op(-1,==, crypto_pk_public_checksig_digest(pk1, data1, 11, data2, 128));
+  tt_int_op(0,==,
+            crypto_pk_public_checksig_digest(pk1, data1, 10, data2, 128));
+  tt_int_op(-1,==,
+            crypto_pk_public_checksig_digest(pk1, data1, 11, data2, 128));
 
   /*XXXX test failed signing*/
 
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 61dac5d..3042ec2 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -1602,7 +1602,8 @@ test_a_networkstatus(
     tt_int_op(1,==, networkstatus_add_detached_signatures(con2, dsig1, "test",
                                                      LOG_INFO, &msg));
     tor_free(detached_text2);
-    tt_int_op(1,==, networkstatus_add_detached_signatures(con_md2, dsig1, "test",
+    tt_int_op(1,==,
+              networkstatus_add_detached_signatures(con_md2, dsig1, "test",
                                                      LOG_INFO, &msg));
     tor_free(detached_text2);
     detached_text2 = get_detached_sigs(con2,con_md2);
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 4e731ce..ae96be4 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -306,14 +306,22 @@ test_util_time(void *arg)
   t_res = 0;
   tt_int_op(0,==, parse_rfc1123_time("Wed, 04 Aug 2004 00:48:22 ZUL", &t_res));
   tt_int_op(t_res,==, (time_t)1091580502UL);
-  tt_int_op(-1,==, parse_rfc1123_time("Wed, zz Aug 2004 99-99x99 GMT", &t_res));
-  tt_int_op(-1,==, parse_rfc1123_time("Wed, 32 Mar 2011 00:00:00 GMT", &t_res));
-  tt_int_op(-1,==, parse_rfc1123_time("Wed, 30 Mar 2011 24:00:00 GMT", &t_res));
-  tt_int_op(-1,==, parse_rfc1123_time("Wed, 30 Mar 2011 23:60:00 GMT", &t_res));
-  tt_int_op(-1,==, parse_rfc1123_time("Wed, 30 Mar 2011 23:59:62 GMT", &t_res));
-  tt_int_op(-1,==, parse_rfc1123_time("Wed, 30 Mar 1969 23:59:59 GMT", &t_res));
-  tt_int_op(-1,==, parse_rfc1123_time("Wed, 30 Ene 2011 23:59:59 GMT", &t_res));
-  tt_int_op(-1,==, parse_rfc1123_time("Wed, 30 Mar 2011 23:59:59 GM", &t_res));
+  tt_int_op(-1,==,
+            parse_rfc1123_time("Wed, zz Aug 2004 99-99x99 GMT", &t_res));
+  tt_int_op(-1,==,
+            parse_rfc1123_time("Wed, 32 Mar 2011 00:00:00 GMT", &t_res));
+  tt_int_op(-1,==,
+            parse_rfc1123_time("Wed, 30 Mar 2011 24:00:00 GMT", &t_res));
+  tt_int_op(-1,==,
+            parse_rfc1123_time("Wed, 30 Mar 2011 23:60:00 GMT", &t_res));
+  tt_int_op(-1,==,
+            parse_rfc1123_time("Wed, 30 Mar 2011 23:59:62 GMT", &t_res));
+  tt_int_op(-1,==,
+            parse_rfc1123_time("Wed, 30 Mar 1969 23:59:59 GMT", &t_res));
+  tt_int_op(-1,==,
+            parse_rfc1123_time("Wed, 30 Ene 2011 23:59:59 GMT", &t_res));
+  tt_int_op(-1,==,
+            parse_rfc1123_time("Wed, 30 Mar 2011 23:59:59 GM", &t_res));
 
 #if 0
   /* This fails, I imagine it's important and should be fixed? */
@@ -404,24 +412,35 @@ test_util_parse_http_time(void *arg)
 
   /* Test parse_http_time */
 
-  tt_int_op(-1,==, parse_http_time("", &a_time));
-  tt_int_op(-1,==, parse_http_time("Sunday, 32 Aug 2004 00:48:22 GMT", &a_time));
-  tt_int_op(-1,==, parse_http_time("Sunday, 3 Aug 1869 00:48:22 GMT", &a_time));
-  tt_int_op(-1,==, parse_http_time("Sunday, 32-Aug-94 00:48:22 GMT", &a_time));
-  tt_int_op(-1,==, parse_http_time("Sunday, 3-Ago-04 00:48:22", &a_time));
-  tt_int_op(-1,==, parse_http_time("Sunday, August the third", &a_time));
-  tt_int_op(-1,==, parse_http_time("Wednesday,,04 Aug 1994 00:48:22 GMT", &a_time));
-
-  tt_int_op(0,==, parse_http_time("Wednesday, 04 Aug 1994 00:48:22 GMT", &a_time));
+  tt_int_op(-1,==,
+            parse_http_time("", &a_time));
+  tt_int_op(-1,==,
+            parse_http_time("Sunday, 32 Aug 2004 00:48:22 GMT", &a_time));
+  tt_int_op(-1,==,
+            parse_http_time("Sunday, 3 Aug 1869 00:48:22 GMT", &a_time));
+  tt_int_op(-1,==,
+            parse_http_time("Sunday, 32-Aug-94 00:48:22 GMT", &a_time));
+  tt_int_op(-1,==,
+            parse_http_time("Sunday, 3-Ago-04 00:48:22", &a_time));
+  tt_int_op(-1,==,
+            parse_http_time("Sunday, August the third", &a_time));
+  tt_int_op(-1,==,
+            parse_http_time("Wednesday,,04 Aug 1994 00:48:22 GMT", &a_time));
+
+  tt_int_op(0,==,
+            parse_http_time("Wednesday, 04 Aug 1994 00:48:22 GMT", &a_time));
   tt_int_op((time_t)775961302UL,==, tor_timegm(&a_time));
   T("1994-08-04 00:48:22");
-  tt_int_op(0,==, parse_http_time("Wednesday, 4 Aug 1994 0:48:22 GMT", &a_time));
+  tt_int_op(0,==,
+            parse_http_time("Wednesday, 4 Aug 1994 0:48:22 GMT", &a_time));
   tt_int_op((time_t)775961302UL,==, tor_timegm(&a_time));
   T("1994-08-04 00:48:22");
-  tt_int_op(0,==, parse_http_time("Miercoles, 4 Aug 1994 0:48:22 GMT", &a_time));
+  tt_int_op(0,==,
+            parse_http_time("Miercoles, 4 Aug 1994 0:48:22 GMT", &a_time));
   tt_int_op((time_t)775961302UL,==, tor_timegm(&a_time));
   T("1994-08-04 00:48:22");
-  tt_int_op(0,==, parse_http_time("Wednesday, 04-Aug-94 00:48:22 GMT", &a_time));
+  tt_int_op(0,==,
+            parse_http_time("Wednesday, 04-Aug-94 00:48:22 GMT", &a_time));
   tt_int_op((time_t)775961302UL,==, tor_timegm(&a_time));
   T("1994-08-04 00:48:22");
   tt_int_op(0,==, parse_http_time("Wednesday, 4-Aug-94 0:48:22 GMT", &a_time));
@@ -1119,7 +1138,8 @@ test_util_strmisc(void *arg)
 #define TOOBIG "100000000000000000000000000"
     tt_int_op(0L,==, tor_parse_long(TOOBIG, 10, LONG_MIN, LONG_MAX, &i, NULL));
     tt_int_op(i,==, 0);
-    tt_int_op(0L,==, tor_parse_long("-"TOOBIG, 10, LONG_MIN, LONG_MAX, &i, NULL));
+    tt_int_op(0L,==,
+              tor_parse_long("-"TOOBIG, 10, LONG_MIN, LONG_MAX, &i, NULL));
     tt_int_op(i,==, 0);
     tt_int_op(0UL,==, tor_parse_ulong(TOOBIG, 10, 0, ULONG_MAX, &i, NULL));
     tt_int_op(i,==, 0);
@@ -1266,7 +1286,8 @@ test_util_strmisc(void *arg)
       binary_data[i] = i;
     tt_str_op(hex_str(binary_data, 0),==, "");
     tt_str_op(hex_str(binary_data, 1),==, "00");
-    tt_str_op(hex_str(binary_data, 17),==, "000102030405060708090A0B0C0D0E0F10");
+    tt_str_op(hex_str(binary_data, 17),==,
+              "000102030405060708090A0B0C0D0E0F10");
     tt_str_op(hex_str(binary_data, 32),==,
                "000102030405060708090A0B0C0D0E0F"
                "101112131415161718191A1B1C1D1E1F");
@@ -1312,7 +1333,7 @@ test_util_pow2(void *arg)
   tt_int_op(tor_log2(64),==, 6);
   tt_int_op(tor_log2(65),==, 6);
   tt_int_op(tor_log2(63),==, 5);
-  tt_int_op(tor_log2(0),==, 0); /* incorrect mathematically, but as specified */
+  tt_int_op(tor_log2(0),==, 0);/* incorrect mathematically, but as specified */
   tt_int_op(tor_log2(1),==, 0);
   tt_int_op(tor_log2(2),==, 1);
   tt_int_op(tor_log2(3),==, 1);
@@ -1577,7 +1598,7 @@ test_util_gzip(void *arg)
 
   tt_assert(!tor_gzip_uncompress(&buf3, &len2, buf1, 1024-len1,
                                   ZLIB_METHOD, 1, LOG_WARN));
-  tt_str_op(buf3,==, "ABCDEFGHIJABCDEFGHIJ"); /*Make sure it compressed right.*/
+  tt_str_op(buf3,==,"ABCDEFGHIJABCDEFGHIJ"); /*Make sure it compressed right.*/
   tt_int_op(21,==, len2);
 
  done:
@@ -1711,7 +1732,8 @@ test_util_sscanf(void *arg)
   /* Simple tests (malformed patterns, literal matching, ...) */
   (void)arg;
   tt_int_op(-1,==, tor_sscanf("123", "%i", &r)); /* %i is not supported */
-  tt_int_op(-1,==, tor_sscanf("wrong", "%5c", s1)); /* %c cannot have a number. */
+  tt_int_op(-1,==,
+            tor_sscanf("wrong", "%5c", s1)); /* %c cannot have a number. */
   tt_int_op(-1,==, tor_sscanf("hello", "%s", s1)); /* %s needs a number. */
   tt_int_op(-1,==, tor_sscanf("prettylongstring", "%999999s", s1));
 #if 0
@@ -1723,13 +1745,17 @@ test_util_sscanf(void *arg)
   tt_int_op(0,==, tor_sscanf("hello world", "hello world"));
   tt_int_op(0,==, tor_sscanf("hello world", "good bye"));
   /* Excess data */
-  tt_int_op(0,==, tor_sscanf("hello 3", "%u", &u1));  /* have to match the start */
+  tt_int_op(0,==,
+            tor_sscanf("hello 3", "%u", &u1));  /* have to match the start */
   tt_int_op(0,==, tor_sscanf(" 3 hello", "%u", &u1));
-  tt_int_op(0,==, tor_sscanf(" 3 hello", "%2u", &u1)); /* not even in this case */
-  tt_int_op(1,==, tor_sscanf("3 hello", "%u", &u1));  /* but trailing is alright */
+  tt_int_op(0,==,
+            tor_sscanf(" 3 hello", "%2u", &u1)); /* not even in this case */
+  tt_int_op(1,==,
+            tor_sscanf("3 hello", "%u", &u1));  /* but trailing is alright */
 
   /* Numbers (ie. %u) */
-  tt_int_op(0,==, tor_sscanf("hello world 3", "hello worlb %u", &u1)); /* d vs b */
+  tt_int_op(0,==,
+            tor_sscanf("hello world 3", "hello worlb %u", &u1)); /* d vs b */
   tt_int_op(1,==, tor_sscanf("12345", "%u", &u1));
   tt_int_op(12345u,==, u1);
   tt_int_op(1,==, tor_sscanf("12346 ", "%u", &u1));
@@ -1759,7 +1785,8 @@ test_util_sscanf(void *arg)
   tt_int_op(12u,==, u1);
   tt_int_op(3u,==, u2);
   tt_int_op(456u,==, u3);
-  tt_int_op(3,==, tor_sscanf("67:8:099", "%2u:%2u:%3u", &u1, &u2, &u3)); /* 0s */
+  tt_int_op(3,==,
+            tor_sscanf("67:8:099", "%2u:%2u:%3u", &u1, &u2, &u3)); /* 0s */
   tt_int_op(67u,==, u1);
   tt_int_op(8u,==, u2);
   tt_int_op(99u,==, u3);
@@ -1822,13 +1849,15 @@ test_util_sscanf(void *arg)
   tt_int_op(2,==, tor_sscanf("bye   world?", "%9s %9s", s1, s2));
   tt_str_op(s1,==, "bye");
   tt_str_op(s2,==, "");
-  tt_int_op(3,==, tor_sscanf("hi", "%9s%9s%3s", s1, s2, s3)); /* %s can be empty. */
+  tt_int_op(3,==,
+            tor_sscanf("hi", "%9s%9s%3s", s1, s2, s3)); /* %s can be empty. */
   tt_str_op(s1,==, "hi");
   tt_str_op(s2,==, "");
   tt_str_op(s3,==, "");
 
   tt_int_op(3,==, tor_sscanf("1.2.3", "%u.%u.%u%c", &u1, &u2, &u3, &ch));
-  tt_int_op(4,==, tor_sscanf("1.2.3 foobar", "%u.%u.%u%c", &u1, &u2, &u3, &ch));
+  tt_int_op(4,==,
+            tor_sscanf("1.2.3 foobar", "%u.%u.%u%c", &u1, &u2, &u3, &ch));
   tt_int_op(' ',==, ch);
 
   r = tor_sscanf("12345 -67890 -1", "%d %ld %d", &int1, &lng1, &int2);
@@ -2371,7 +2400,8 @@ test_util_find_str_at_start_of_line(void *ptr)
   tt_ptr_op(line2,==, find_str_at_start_of_line(long_string, "hell"));
   tt_ptr_op(line2,==, find_str_at_start_of_line(long_string, "hello k"));
   tt_ptr_op(line2,==, find_str_at_start_of_line(long_string, "hello kitty\n"));
-  tt_ptr_op(line2,==, find_str_at_start_of_line(long_string, "hello kitty\nt"));
+  tt_ptr_op(line2,==,
+            find_str_at_start_of_line(long_string, "hello kitty\nt"));
   tt_ptr_op(line3,==, find_str_at_start_of_line(long_string, "third"));
   tt_ptr_op(line3,==, find_str_at_start_of_line(long_string, "third line"));
   tt_ptr_op(NULL,==,  find_str_at_start_of_line(long_string, "third line\n"));





More information about the tor-commits mailing list