[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Make new logging stuff work on windows; fix a couple of win...



Update of /home/or/cvsroot/tor/src/common
In directory moria:/tmp/cvs-serv27993/src/common

Modified Files:
	compat.c log.c log.h util.c 
Log Message:
Make new logging stuff work on windows; fix a couple of windows typos.

Index: compat.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/compat.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -d -r1.76 -r1.77
--- compat.c	25 Oct 2005 07:05:03 -0000	1.76
+++ compat.c	15 Nov 2005 03:05:14 -0000	1.77
@@ -757,7 +757,7 @@
             tor_snprintf(uname_result, sizeof(uname_result),
                          "Unrecognized version of Windows [major=%d,minor=%d] %s",
                          (int)info.dwMajorVersion,(int)info.dwMinorVersion,
-                         infor.szCSDVersion);
+                         info.szCSDVersion);
         }
         if (info.wProductType == VER_NT_DOMAIN_CONTROLLER) {
           strlcat(uname_result, " [domain controller]", sizeof(uname_result));
@@ -768,7 +768,7 @@
         }
         leftover_mask = info.wSuiteMask;
         for (i = 0; win_mask_table[i].mask; ++i) {
-          if (info.wSuiteMask & win_mask_table[i]) {
+          if (info.wSuiteMask & win_mask_table[i].mask) {
             strlcat(uname_result, win_mask_table[i].str, sizeof(uname_result));
             leftover_mask &= ~win_mask_table[i].mask;
           }

Index: log.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/log.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -d -r1.105 -r1.106
--- log.c	13 Nov 2005 22:28:07 -0000	1.105
+++ log.c	15 Nov 2005 03:05:15 -0000	1.106
@@ -264,47 +264,47 @@
   _log_fn_function_name = NULL;
 }
 void
-_debug(uint32_t domain, const char *format, ...)
+debug(uint32_t domain, const char *format, ...)
 {
   va_list ap;
   va_start(ap,format);
-  logv(LOG_DEBUG, domain, _log_fn_function_name, format, ap);
+  logv(LOG_DEBUG, domain, NULL, format, ap);
   va_end(ap);
   _log_fn_function_name = NULL;
 }
 void
-_info(uint32_t domain, const char *format, ...)
+info(uint32_t domain, const char *format, ...)
 {
   va_list ap;
   va_start(ap,format);
-  logv(LOG_INFO, domain, _log_fn_function_name, format, ap);
+  logv(LOG_INFO, domain, NULL, format, ap);
   va_end(ap);
   _log_fn_function_name = NULL;
 }
 void
-_notice(uint32_t domain, const char *format, ...)
+notice(uint32_t domain, const char *format, ...)
 {
   va_list ap;
   va_start(ap,format);
-  logv(LOG_NOTICE, domain, _log_fn_function_name, format, ap);
+  logv(LOG_NOTICE, domain, NULL, format, ap);
   va_end(ap);
   _log_fn_function_name = NULL;
 }
 void
-_warn(uint32_t domain, const char *format, ...)
+warn(uint32_t domain, const char *format, ...)
 {
   va_list ap;
   va_start(ap,format);
-  logv(LOG_WARN, domain, _log_fn_function_name, format, ap);
+  logv(LOG_WARN, domain, NULL, format, ap);
   va_end(ap);
   _log_fn_function_name = NULL;
 }
 void
-_err(uint32_t domain, const char *format, ...)
+err(uint32_t domain, const char *format, ...)
 {
   va_list ap;
   va_start(ap,format);
-  logv(LOG_ERR, domain, _log_fn_function_name, format, ap);
+  logv(LOG_ERR, domain, NULL, format, ap);
   va_end(ap);
   _log_fn_function_name = NULL;
 }

Index: log.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/log.h,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- log.h	1 Nov 2005 06:15:48 -0000	1.59
+++ log.h	15 Nov 2005 03:05:15 -0000	1.60
@@ -138,20 +138,22 @@
 #else /* ! defined(__GNUC__) */
 
 void _log_fn(int severity, uint32_t domain, const char *format, ...);
-void _debug(uint32_t domain, const char *format, ...);
-void _info(uint32_t domain, const char *format, ...);
-void _notice(uint32_t domain, const char *format, ...);
-void _warn(uint32_t domain, const char *format, ...);
-void _err(uint32_t domain, const char *format, ...);
+void debug(uint32_t domain, const char *format, ...);
+void info(uint32_t domain, const char *format, ...);
+void notice(uint32_t domain, const char *format, ...);
+void warn(uint32_t domain, const char *format, ...);
+void err(uint32_t domain, const char *format, ...);
 
 #if defined(_MSC_VER) && _MSC_VER < 1300
 /* MSVC 6 and earlier don't have __FUNCTION__, or even __LINE__. */
 #define log_fn _log_fn
+/*
 #define debug _debug
 #define info _info
 #define notice _notice
 #define warn _warn
 #define err _err
+*/
 #else
 /* We don't have GCC's varargs macros, so use a global variable to pass the
  * function name to log_fn */
@@ -160,11 +162,13 @@
  * do {...} while (0) trick to wrap this macro, since the macro can't take
  * arguments. */
 #define log_fn (_log_fn_function_name=__FUNCTION__),_log_fn
+/*
 #define debug (_log_fn_function_name=__FUNCTION__),_debug
 #define info (_log_fn_function_name=__FUNCTION__),_info
 #define notice (_log_fn_function_name=__FUNCTION__),_notice
 #define warn (_log_fn_function_name=__FUNCTION__),_warn
 #define err (_log_fn_function_name=__FUNCTION__),_err
+*/
 #endif
 
 #endif /* !GNUC */

Index: util.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/util.c,v
retrieving revision 1.231
retrieving revision 1.232
diff -u -d -r1.231 -r1.232
--- util.c	25 Oct 2005 07:05:03 -0000	1.231
+++ util.c	15 Nov 2005 03:05:15 -0000	1.232
@@ -433,7 +433,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
@@ -1249,7 +1249,7 @@
     smartlist_add(result, tor_strdup(findData.cFileName));
     if (!FindNextFile(handle, &findData)) {
       if (GetLastError() != ERROR_NO_MORE_FILES) {
-        log_fn(LOG_WARN, "Error reading directory.");
+        warn(LD_FS, "Error reading directory.");
       }
       break;
     }