diff options
author | Roger Dingledine <arma@torproject.org> | 2003-10-07 16:30:05 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2003-10-07 16:30:05 +0000 |
commit | de6cbe53c0caaf09e6e870b50463fa3ad37dfd6f (patch) | |
tree | 0a67bb89726ce6020cac92b9edf7963180373359 /src/common | |
parent | e826873ac657782fde5e635d75de5443ac27fed4 (diff) | |
download | tor-de6cbe53c0caaf09e6e870b50463fa3ad37dfd6f.tar tor-de6cbe53c0caaf09e6e870b50463fa3ad37dfd6f.tar.gz |
some early bugfixes
our log() conflicts with log(3)
distribute only the correct files from doc/ and src/config/
sometimes laptops go back in time. i guess that's ok for now.
and bump the version number because we're live.
svn:r544
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/log.c | 2 | ||||
-rw-r--r-- | src/common/log.h | 5 | ||||
-rw-r--r-- | src/common/util.c | 6 | ||||
-rw-r--r-- | src/common/util.h | 1 |
4 files changed, 8 insertions, 6 deletions
diff --git a/src/common/log.c b/src/common/log.c index 70646201a..a56a1e95b 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -103,7 +103,7 @@ log_set_severity(int severity) } /* Outputs a message to stdout */ -void log(int severity, const char *format, ...) +void _log(int severity, const char *format, ...) { va_list ap; va_start(ap,format); diff --git a/src/common/log.h b/src/common/log.h index 9b9d072ee..8e0e5fc33 100644 --- a/src/common/log.h +++ b/src/common/log.h @@ -36,7 +36,7 @@ void close_logs(); void reset_logs(); /* Outputs a message to stdout */ -void log(int severity, const char *format, ...) CHECK_PRINTF(2,3); +void _log(int severity, const char *format, ...) CHECK_PRINTF(2,3); #ifdef __GNUC__ void _log_fn(int severity, const char *funcname, const char *format, ...) @@ -44,8 +44,9 @@ void _log_fn(int severity, const char *funcname, const char *format, ...) #define log_fn(severity, args...) \ _log_fn(severity, __PRETTY_FUNCTION__, args) #else -#define log_fn log +#define log_fn _log #endif +#define log _log /* hack it so we don't conflict with log() as much */ # define __LOG_H #endif diff --git a/src/common/util.c b/src/common/util.c index a4b2bd0b3..c87665c25 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -61,7 +61,6 @@ long tv_udiff(struct timeval *start, struct timeval *end) { long udiff; - long end_usec = end->tv_usec; long secdiff = end->tv_sec - start->tv_sec; if (secdiff+1 > LONG_MAX/1000000) { @@ -69,9 +68,10 @@ tv_udiff(struct timeval *start, struct timeval *end) return LONG_MAX; } - udiff = secdiff*1000000L + (end_usec - start->tv_usec); + udiff = secdiff*1000000L + (end->tv_usec - start->tv_usec); if(udiff < 0) { - log_fn(LOG_WARNING, "start is after end. Returning 0."); + log_fn(LOG_INFO, "start (%ld.%ld) is after end (%ld.%ld). Returning 0.", + start->tv_sec, start->tv_usec, end->tv_sec, end->tv_usec); return 0; } return udiff; diff --git a/src/common/util.h b/src/common/util.h index 40e35d962..358134bed 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -32,6 +32,7 @@ #define INLINE inline #endif +#define xfree(p) do {if(p) {free(p); (p)=NULL;}} while(0) /* XXX use everywhere? */ void *tor_malloc(size_t size); char *tor_strdup(const char *s); void tor_gettimeofday(struct timeval *timeval); |