summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-11-08 08:09:40 -0500
committerGitHub <noreply@github.com>2016-11-08 08:09:40 -0500
commita809cee58249cc2f42222f1ab5d4746d634c2668 (patch)
tree1dbd042bd61e17b01ad12143dfb171ecd4e7dbcd /src/basic
parentb719b26cb34e8f2ac752ae7dca2c100b656195a4 (diff)
parent6e2b4a6994e29544cb25e5387961d8a9dcf65063 (diff)
Merge pull request #4612 from keszybz/format-strings
Format string tweaks (and a small fix on 32bit)
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/cgroup-util.c2
-rw-r--r--src/basic/format-util.h (renamed from src/basic/formats-util.h)0
-rw-r--r--src/basic/log.c2
-rw-r--r--src/basic/process-util.h2
-rw-r--r--src/basic/rlimit-util.c2
-rw-r--r--src/basic/socket-util.c2
-rw-r--r--src/basic/time-util.c8
-rw-r--r--src/basic/time-util.h6
-rw-r--r--src/basic/user-util.c2
-rw-r--r--src/basic/util.c2
-rw-r--r--src/basic/util.h2
11 files changed, 16 insertions, 14 deletions
diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index 5fce32f769..5e73753935 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -38,7 +38,7 @@
#include "extract-word.h"
#include "fd-util.h"
#include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
#include "fs-util.h"
#include "log.h"
#include "login-util.h"
diff --git a/src/basic/formats-util.h b/src/basic/format-util.h
index 39a185f59b..39a185f59b 100644
--- a/src/basic/formats-util.h
+++ b/src/basic/format-util.h
diff --git a/src/basic/log.c b/src/basic/log.c
index 4919d175da..f5cff4cc9f 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -37,7 +37,7 @@
#include "alloc-util.h"
#include "fd-util.h"
-#include "formats-util.h"
+#include "format-util.h"
#include "io-util.h"
#include "log.h"
#include "macro.h"
diff --git a/src/basic/process-util.h b/src/basic/process-util.h
index 2568e3834f..89dfeb4d6a 100644
--- a/src/basic/process-util.h
+++ b/src/basic/process-util.h
@@ -28,7 +28,7 @@
#include <sys/types.h>
#include <sys/resource.h>
-#include "formats-util.h"
+#include "format-util.h"
#include "macro.h"
#define procfs_file_alloca(pid, field) \
diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
index ee063720ed..ca834df621 100644
--- a/src/basic/rlimit-util.c
+++ b/src/basic/rlimit-util.c
@@ -22,7 +22,7 @@
#include "alloc-util.h"
#include "extract-word.h"
-#include "formats-util.h"
+#include "format-util.h"
#include "macro.h"
#include "missing.h"
#include "rlimit-util.h"
diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c
index 1662c04705..4ebf106109 100644
--- a/src/basic/socket-util.c
+++ b/src/basic/socket-util.c
@@ -34,7 +34,7 @@
#include "alloc-util.h"
#include "fd-util.h"
#include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
#include "log.h"
#include "macro.h"
#include "missing.h"
diff --git a/src/basic/time-util.c b/src/basic/time-util.c
index fedff1362c..cbdfd55ada 100644
--- a/src/basic/time-util.c
+++ b/src/basic/time-util.c
@@ -309,7 +309,7 @@ static char *format_timestamp_internal(
if (n + 8 > l)
return NULL; /* Microseconds part doesn't fit. */
- sprintf(buf + n, ".%06llu", (unsigned long long) (t % USEC_PER_SEC));
+ sprintf(buf + n, ".%06"PRI_USEC, t % USEC_PER_SEC);
}
/* Append the timezone */
@@ -499,11 +499,11 @@ char *format_timespan(char *buf, size_t l, usec_t t, usec_t accuracy) {
if (j > 0) {
k = snprintf(p, l,
- "%s"USEC_FMT".%0*llu%s",
+ "%s"USEC_FMT".%0*"PRI_USEC"%s",
p > buf ? " " : "",
a,
j,
- (unsigned long long) b,
+ b,
table[i].suffix);
t = 0;
@@ -1320,7 +1320,7 @@ unsigned long usec_to_jiffies(usec_t u) {
r = sysconf(_SC_CLK_TCK);
assert(r > 0);
- hz = (unsigned long) r;
+ hz = r;
}
return DIV_ROUND_UP(u , USEC_PER_SEC / hz);
diff --git a/src/basic/time-util.h b/src/basic/time-util.h
index 558b0b5b7f..f67a4474ed 100644
--- a/src/basic/time-util.h
+++ b/src/basic/time-util.h
@@ -29,8 +29,10 @@
typedef uint64_t usec_t;
typedef uint64_t nsec_t;
-#define NSEC_FMT "%" PRIu64
-#define USEC_FMT "%" PRIu64
+#define PRI_NSEC PRIu64
+#define PRI_USEC PRIu64
+#define NSEC_FMT "%" PRI_NSEC
+#define USEC_FMT "%" PRI_USEC
#include "macro.h"
diff --git a/src/basic/user-util.c b/src/basic/user-util.c
index de6c93056e..938533d2e7 100644
--- a/src/basic/user-util.c
+++ b/src/basic/user-util.c
@@ -34,7 +34,7 @@
#include "alloc-util.h"
#include "fd-util.h"
#include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
#include "macro.h"
#include "missing.h"
#include "parse-util.h"
diff --git a/src/basic/util.c b/src/basic/util.c
index 0f65e4839c..c1b5ca1ef7 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -41,7 +41,7 @@
#include "dirent-util.h"
#include "fd-util.h"
#include "fileio.h"
-#include "formats-util.h"
+#include "format-util.h"
#include "hashmap.h"
#include "hostname-util.h"
#include "log.h"
diff --git a/src/basic/util.h b/src/basic/util.h
index bb2fc318ef..c3802a811c 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -41,7 +41,7 @@
#include <time.h>
#include <unistd.h>
-#include "formats-util.h"
+#include "format-util.h"
#include "macro.h"
#include "missing.h"
#include "time-util.h"