summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-11-15 03:05:23 +0000
committerNick Mathewson <nickm@torproject.org>2005-11-15 03:05:23 +0000
commit9b432311c4d692d68f913027a95e050b1067c5d9 (patch)
treeb1488e36ea7fd8691f6ac1c2d2c2cf2cb0eabd90 /src/common
parent4cd7bddfc332aa14621235beb649b73f494266b0 (diff)
downloadtor-9b432311c4d692d68f913027a95e050b1067c5d9.tar.gz
tor-9b432311c4d692d68f913027a95e050b1067c5d9.zip
Make new logging stuff work on windows; fix a couple of windows typos.
svn:r5375
Diffstat (limited to 'src/common')
-rw-r--r--src/common/compat.c4
-rw-r--r--src/common/log.c20
-rw-r--r--src/common/log.h14
-rw-r--r--src/common/util.c4
4 files changed, 23 insertions, 19 deletions
diff --git a/src/common/compat.c b/src/common/compat.c
index 69b58b619a..703011f6cf 100644
--- a/src/common/compat.c
+++ b/src/common/compat.c
@@ -757,7 +757,7 @@ get_uname(void)
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 @@ get_uname(void)
}
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;
}
diff --git a/src/common/log.c b/src/common/log.c
index 85cd04df44..3cb7b764cb 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -264,47 +264,47 @@ _log_fn(int severity, uint32_t domain, const char *format, ...)
_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;
}
diff --git a/src/common/log.h b/src/common/log.h
index dd7dcbd9b7..40d66aab2a 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -138,20 +138,22 @@ void _log_fn(int severity, uint32_t domain,
#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 @@ extern const char *_log_fn_function_name;
* 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 */
diff --git a/src/common/util.c b/src/common/util.c
index dd289ff258..2d43f18600 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -433,7 +433,7 @@ find_whitespace(const char *s)
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 @@ tor_listdir(const char *dirname)
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;
}