diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-04-25 07:45:15 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2014-05-15 15:29:58 +0200 |
commit | de0671ee7fe465e108f62dcbbbe9366f81dd9e9a (patch) | |
tree | 3ee30af44852655c365104703359b47a6e6219b5 /src/test | |
parent | 12ed81d9c88406234c20e9261ae8c8b992d8bc4d (diff) |
Remove unnecessary casts in printfs
No functional change expected :)
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-cgroup-util.c | 6 | ||||
-rw-r--r-- | src/test/test-log.c | 7 | ||||
-rw-r--r-- | src/test/test-time.c | 4 | ||||
-rw-r--r-- | src/test/test-util.c | 6 |
4 files changed, 12 insertions, 11 deletions
diff --git a/src/test/test-cgroup-util.c b/src/test/test-cgroup-util.c index b37468b70e..fda8bcc5c5 100644 --- a/src/test/test-cgroup-util.c +++ b/src/test/test-cgroup-util.c @@ -162,11 +162,11 @@ static void test_proc(void) { cg_pid_get_machine_name(pid, &machine); cg_pid_get_slice(pid, &slice); - printf("%lu\t%s\t%s\t%lu\t%s\t%s\t%s\t%s\t%s\n", - (unsigned long) pid, + printf(PID_FMT"\t%s\t%s\t"UID_FMT"\t%s\t%s\t%s\t%s\t%s\n", + pid, path, path_shifted, - (unsigned long) uid, + uid, session, unit, user_unit, diff --git a/src/test/test-log.c b/src/test/test-log.c index 8dc3d5383f..ca64004b4c 100644 --- a/src/test/test-log.c +++ b/src/test/test-log.c @@ -23,6 +23,7 @@ #include <unistd.h> #include "log.h" +#include "util.h" int main(int argc, char* argv[]) { @@ -30,7 +31,7 @@ int main(int argc, char* argv[]) { log_open(); log_struct(LOG_INFO, - "MESSAGE=Waldo PID=%lu", (unsigned long) getpid(), + "MESSAGE=Waldo PID="PID_FMT, getpid(), "SERVICE=piepapo", NULL); @@ -38,12 +39,12 @@ int main(int argc, char* argv[]) { log_open(); log_struct(LOG_INFO, - "MESSAGE=Foobar PID=%lu", (unsigned long) getpid(), + "MESSAGE=Foobar PID="PID_FMT, getpid(), "SERVICE=foobar", NULL); log_struct(LOG_INFO, - "MESSAGE=Foobar PID=%lu", (unsigned long) getpid(), + "MESSAGE=Foobar PID="PID_FMT, getpid(), "FORMAT_STR_TEST=1=%i A=%c 2=%hi 3=%li 4=%lli 1=%p foo=%s 2.5=%g 3.5=%g 4.5=%Lg", (int) 1, 'A', (short) 2, (long int) 3, (long long int) 4, (void*) 1, "foo", (float) 2.5f, (double) 3.5, (long double) 4.5, "SUFFIX=GOT IT", diff --git a/src/test/test-time.c b/src/test/test-time.c index 36a33046a2..7c29f96a34 100644 --- a/src/test/test-time.c +++ b/src/test/test-time.c @@ -84,7 +84,7 @@ static void test_format_timespan_one(usec_t x, usec_t accuracy) { char l[FORMAT_TIMESPAN_MAX]; usec_t y; - log_info("%llu (at accuracy %llu)", (unsigned long long) x, (unsigned long long) accuracy); + log_info(USEC_FMT" (at accuracy "USEC_FMT")", x, accuracy); r = format_timespan(l, sizeof(l), x, accuracy); assert_se(r); @@ -93,7 +93,7 @@ static void test_format_timespan_one(usec_t x, usec_t accuracy) { assert_se(parse_sec(l, &y) >= 0); - log_info(" = %llu", (unsigned long long) y); + log_info(" = "USEC_FMT, y); if (accuracy <= 0) accuracy = 1; diff --git a/src/test/test-util.c b/src/test/test-util.c index caf8d2b12b..2b46699125 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -434,7 +434,7 @@ static void test_get_process_comm(void) { log_info("pid1 cmdline truncated: '%s'", d); assert_se(get_parent_of_pid(1, &e) >= 0); - log_info("pid1 ppid: '%llu'", (unsigned long long) e); + log_info("pid1 ppid: "PID_FMT, e); assert_se(e == 0); assert_se(is_kernel_thread(1) == 0); @@ -444,11 +444,11 @@ static void test_get_process_comm(void) { log_info("pid1 exe: '%s'", strna(f)); assert_se(get_process_uid(1, &u) == 0); - log_info("pid1 uid: '%llu'", (unsigned long long) u); + log_info("pid1 uid: "UID_FMT, u); assert_se(u == 0); assert_se(get_process_gid(1, &g) == 0); - log_info("pid1 gid: '%llu'", (unsigned long long) g); + log_info("pid1 gid: "GID_FMT, g); assert_se(g == 0); assert(get_ctty_devnr(1, &h) == -ENOENT); |