summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-03 10:40:59 -0400
committerNick Mathewson <nickm@torproject.org>2018-07-03 10:40:59 -0400
commit9568c0ce3d3885a41ca44ac030b04d089ac56a40 (patch)
tree1517c61a9f45ded3fc961231d517c02dc94a5860 /src/lib
parent52884f56d43670f1960d9354ccc3ace9a048e283 (diff)
downloadtor-9568c0ce3d3885a41ca44ac030b04d089ac56a40.tar.gz
tor-9568c0ce3d3885a41ca44ac030b04d089ac56a40.zip
Return U64_PRINTF_ARG and U64_FORMAT
The standard is printf("%"PRIu64, x);
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cc/compat_compiler.h5
-rw-r--r--src/lib/time/tvdiff.c20
-rw-r--r--src/lib/wallclock/tm_cvt.c4
3 files changed, 12 insertions, 17 deletions
diff --git a/src/lib/cc/compat_compiler.h b/src/lib/cc/compat_compiler.h
index f14e48813e..42ceeadd3e 100644
--- a/src/lib/cc/compat_compiler.h
+++ b/src/lib/cc/compat_compiler.h
@@ -188,11 +188,6 @@
#define MINGW_ANY
#endif
-#define U64_PRINTF_ARG(a) ((uint64_t)a)
-#define I64_PRINTF_ARG(a) ((int64_t)a)
-#define U64_FORMAT "%"PRIu64
-#define I64_FORMAT "%"PRId64
-
/** Macro: yield a pointer to the field at position <b>off</b> within the
* structure <b>st</b>. Example:
* <pre>
diff --git a/src/lib/time/tvdiff.c b/src/lib/time/tvdiff.c
index 5dbc0fd19c..0af45a208b 100644
--- a/src/lib/time/tvdiff.c
+++ b/src/lib/time/tvdiff.c
@@ -51,15 +51,15 @@ tv_udiff(const struct timeval *start, const struct timeval *end)
/* Sanity check tv_usec */
if (start->tv_usec > TOR_USEC_PER_SEC || start->tv_usec < 0) {
log_warn(LD_GENERAL, "comparing times on microsecond detail with bad "
- "start tv_usec: " I64_FORMAT " microseconds",
- I64_PRINTF_ARG(start->tv_usec));
+ "start tv_usec: %"PRId64 " microseconds",
+ (start->tv_usec));
return LONG_MAX;
}
if (end->tv_usec > TOR_USEC_PER_SEC || end->tv_usec < 0) {
log_warn(LD_GENERAL, "comparing times on microsecond detail with bad "
- "end tv_usec: " I64_FORMAT " microseconds",
- I64_PRINTF_ARG(end->tv_usec));
+ "end tv_usec: %"PRId64 " microseconds",
+ (end->tv_usec));
return LONG_MAX;
}
@@ -72,7 +72,7 @@ tv_udiff(const struct timeval *start, const struct timeval *end)
if (secdiff > (int64_t)(LONG_MAX/1000000 - 1) ||
secdiff < (int64_t)(LONG_MIN/1000000 + 1)) {
log_warn(LD_GENERAL, "comparing times on microsecond detail too far "
- "apart: " I64_FORMAT " seconds", I64_PRINTF_ARG(secdiff));
+ "apart: %"PRId64 " seconds", (secdiff));
return LONG_MAX;
}
@@ -100,15 +100,15 @@ tv_mdiff(const struct timeval *start, const struct timeval *end)
/* Sanity check tv_usec */
if (start->tv_usec > TOR_USEC_PER_SEC || start->tv_usec < 0) {
log_warn(LD_GENERAL, "comparing times on millisecond detail with bad "
- "start tv_usec: " I64_FORMAT " microseconds",
- I64_PRINTF_ARG(start->tv_usec));
+ "start tv_usec: %"PRId64 " microseconds",
+ (start->tv_usec));
return LONG_MAX;
}
if (end->tv_usec > TOR_USEC_PER_SEC || end->tv_usec < 0) {
log_warn(LD_GENERAL, "comparing times on millisecond detail with bad "
- "end tv_usec: " I64_FORMAT " microseconds",
- I64_PRINTF_ARG(end->tv_usec));
+ "end tv_usec: %"PRId64 " microseconds",
+ (end->tv_usec));
return LONG_MAX;
}
@@ -124,7 +124,7 @@ tv_mdiff(const struct timeval *start, const struct timeval *end)
if (secdiff > (int64_t)(LONG_MAX/1000 - 2) ||
secdiff < (int64_t)(LONG_MIN/1000 + 1)) {
log_warn(LD_GENERAL, "comparing times on millisecond detail too far "
- "apart: " I64_FORMAT " seconds", I64_PRINTF_ARG(secdiff));
+ "apart: %"PRId64 " seconds", (secdiff));
return LONG_MAX;
}
diff --git a/src/lib/wallclock/tm_cvt.c b/src/lib/wallclock/tm_cvt.c
index 987b0ffebf..0a1a1cd438 100644
--- a/src/lib/wallclock/tm_cvt.c
+++ b/src/lib/wallclock/tm_cvt.c
@@ -100,9 +100,9 @@ correct_tm(int islocal, const time_t *timep, struct tm *resultbuf,
/* LCOV_EXCL_STOP */
done:
if (err_out) {
- tor_asprintf(err_out, "%s("I64_FORMAT") failed with error %s: %s",
+ tor_asprintf(err_out, "%s(%"PRId64") failed with error %s: %s",
islocal?"localtime":"gmtime",
- timep?I64_PRINTF_ARG(*timep):0,
+ timep?(*timep):0,
strerror(errno),
outcome);
}