[or-cvs] Normalize whitespace; add a "tell me about all the unnormal...

Nick Mathewson nickm at seul.org
Tue Nov 9 20:04:03 UTC 2004


Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/tmp/cvs-serv28856/src/common

Modified Files:
	compat.c crypto.c log.c log.h torgzip.c torint.h tortls.c 
	util.c 
Log Message:
Normalize whitespace; add a "tell me about all the unnormalized whitespace" target; fix a braino in dirserv.c

Index: compat.c
===================================================================
RCS file: /home/or/cvsroot/src/common/compat.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- compat.c	9 Nov 2004 19:30:50 -0000	1.7
+++ compat.c	9 Nov 2004 20:04:00 -0000	1.8
@@ -2,7 +2,6 @@
 /* See LICENSE for licensing information */
 /* $Id$ */
 
-
 /* This is required on rh7 to make strptime not complain.
  */
 #define _GNU_SOURCE
@@ -488,7 +487,6 @@
 #endif
 }
 
-
 /** Set *timeval to the current time of day.  On error, log and terminate.
  * (Same as gettimeofday(timeval,NULL), but never returns -1.)
  */
@@ -560,7 +558,6 @@
 }
 #endif
 
-
 /**
  * On Windows, WSAEWOULDBLOCK is not always correct: when you see it,
  * you need to ask the socket for its actual errno.  Also, you need to

Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/src/common/crypto.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- crypto.c	3 Nov 2004 19:49:03 -0000	1.121
+++ crypto.c	9 Nov 2004 20:04:00 -0000	1.122
@@ -99,7 +99,6 @@
 EVP_PKEY *_crypto_pk_env_get_evp_pkey(crypto_pk_env_t *env, int private);
 DH *_crypto_dh_env_get_dh(crypto_dh_env_t *dh);
 
-
 /** Return the number of bytes added by padding method <b>padding</b>.
  */
 static INLINE int
@@ -739,7 +738,6 @@
   return crypto_pk_private_sign(env,to,digest,DIGEST_LEN);
 }
 
-
 /** Perform a hybrid (public/secret) encryption on <b>fromlen</b>
  * bytes of data from <b>from</b>, with padding type 'padding',
  * storing the results on <b>to</b>.

Index: log.c
===================================================================
RCS file: /home/or/cvsroot/src/common/log.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- log.c	9 Nov 2004 01:24:10 -0000	1.62
+++ log.c	9 Nov 2004 20:04:00 -0000	1.63
@@ -124,7 +124,7 @@
     else
       n += r;
   }
-  
+
   r = tor_vsnprintf(buf+n,buf_len-n,format,ap);
   if(r < 0) {
     n = buf_len-2;
@@ -413,7 +413,6 @@
   return min;
 }
 
-
 /*
   Local Variables:
   mode:c

Index: log.h
===================================================================
RCS file: /home/or/cvsroot/src/common/log.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- log.h	5 Nov 2004 05:50:34 -0000	1.32
+++ log.h	9 Nov 2004 20:04:00 -0000	1.33
@@ -27,7 +27,7 @@
 /* XXXX Note: The code was originally written to refer to severities,
  * with 0 being the least severe; while syslog's logging code refers to
  * priorities, with 0 being the most important.  Thus, all our comparisons
- * needed to be reversed when we added syslog support.  
+ * needed to be reversed when we added syslog support.
  *
  * The upshot of this is that comments about log levels may be messed
  * up: for "maximum severity" read "most severe" and "numerically

Index: torgzip.c
===================================================================
RCS file: /home/or/cvsroot/src/common/torgzip.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- torgzip.c	4 Nov 2004 04:01:19 -0000	1.5
+++ torgzip.c	9 Nov 2004 20:04:00 -0000	1.6
@@ -12,11 +12,11 @@
 
 #include <stdlib.h>
 #include <stdio.h>
-#include <assert.h>
-#ifdef MS_WINDOWS
-#include "..\..\contrib\zlib\zlib.h"
+#include <assert.h>
+#ifdef MS_WINDOWS
+#include "..\..\contrib\zlib\zlib.h"
 #else
-#include <zlib.h>
+#include <zlib.h>
 #endif
 
 #include "util.h"

Index: torint.h
===================================================================
RCS file: /home/or/cvsroot/src/common/torint.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- torint.h	5 Nov 2004 17:54:50 -0000	1.11
+++ torint.h	9 Nov 2004 20:04:00 -0000	1.12
@@ -33,7 +33,6 @@
 #endif
 #endif
 
-
 #if (SIZEOF_INT8_T != 0)
 #define HAVE_INT8_T
 #endif
@@ -87,7 +86,6 @@
 #endif
 #endif
 
-
 #if (SIZEOF_INT == 2)
 #ifndef HAVE_INT16_T
 typedef signed int int16_t;
@@ -111,7 +109,6 @@
 #endif
 #endif
 
-
 #if (SIZEOF_LONG == 4)
 #ifndef HAVE_INT32_T
 typedef signed long int32_t;

Index: tortls.c
===================================================================
RCS file: /home/or/cvsroot/src/common/tortls.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- tortls.c	27 Oct 2004 21:14:10 -0000	1.73
+++ tortls.c	9 Nov 2004 20:04:00 -0000	1.74
@@ -257,7 +257,6 @@
   return x509;
 }
 
-
 #ifdef EVERYONE_HAS_AES
 /* Everybody is running OpenSSL 0.9.7 or later, so no backward compatibility
  * is needed. */

Index: util.c
===================================================================
RCS file: /home/or/cvsroot/src/common/util.c,v
retrieving revision 1.175
retrieving revision 1.176
diff -u -d -r1.175 -r1.176
--- util.c	9 Nov 2004 19:30:50 -0000	1.175
+++ util.c	9 Nov 2004 20:04:00 -0000	1.176
@@ -295,7 +295,6 @@
     return strncmp(s1+(n1-n2), s2, n2);
 }
 
-
 /** Return a pointer to the first char of s that is not whitespace and
  * not a comment, or to the terminating NUL if no such character exists.
  */
@@ -351,8 +350,7 @@
  err:                                                   \
   if (ok) *ok = 0;                                      \
   if (next) *next = endptr;                             \
-  return 0;                                             \
-
+  return 0;
 
 /** Extract a long from the start of s, in the given numeric base.  If
  * there is unconverted data and next is provided, set *next to the
@@ -383,7 +381,7 @@
   r = strtoul(s, &endptr, base);
   CHECK_STRTOX_RESULT();
 }
-
+
 /** Only base 10 is guaranteed to work for now. */
 uint64_t
 tor_parse_uint64(const char *s, int base, uint64_t min,
@@ -413,8 +411,6 @@
   CHECK_STRTOX_RESULT();
 }
 
-
-
 void base16_encode(char *dest, size_t destlen, const char *src, size_t srclen)
 {
   const char *end;
@@ -469,7 +465,6 @@
   return 0;
 }
 
-
 /* =====
  * Time
  * ===== */
@@ -527,7 +522,6 @@
   a->tv_usec %= 1000000;
 }
 
-
 #define IS_LEAPYEAR(y) (!(y % 4) && ((y % 100) || !(y % 400)))
 static int n_leapdays(int y1, int y2) {
   --y1;
@@ -788,11 +782,12 @@
 int
 write_str_to_file(const char *fname, const char *str, int bin)
 {
-#ifdef MS_WINDOWS
-  if (strchr(str, '\r')) {
-    log_fn(LOG_WARN, "How odd. Writing a string that does contain CR already.");
-  }
-#endif
+#ifdef MS_WINDOWS
+  if (!bin && strchr(str, '\r')) {
+    log_fn(LOG_WARN,
+           "How odd. Writing a string that does contain CR already.");
+  }
+#endif
   return write_bytes_to_file(fname, str, strlen(str), bin);
 }
 
@@ -865,7 +860,7 @@
     return NULL;
   }
   string[r] = '\0'; /* NUL-terminate the result. */
-  
+
   if (bin && r != statbuf.st_size) {
     /* If we're in binary mode, then we'd better have an exact match for
      * size.  Otherwise, win32 encoding may throw us off, and that's okay. */
@@ -878,7 +873,7 @@
 #ifdef MS_WINDOWS
   if (!bin && strchr(string, '\r')) {
     log_fn(LOG_DEBUG, "We didn't convert CRLF to LF as well as we hoped when reading %s. Coping.",
-           filename);  
+           filename);
     tor_strstrip(string, "\r");
   }
 #endif



More information about the tor-commits mailing list