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/libsystemd | |
parent | 12ed81d9c88406234c20e9261ae8c8b992d8bc4d (diff) |
Remove unnecessary casts in printfs
No functional change expected :)
Diffstat (limited to 'src/libsystemd')
-rw-r--r-- | src/libsystemd/sd-bus/bus-creds.c | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-dump.c | 26 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-kernel.c | 6 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-socket.c | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-util.c | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/sd-bus.c | 4 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/test-bus-chat.c | 4 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/test-bus-marshal.c | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-login/sd-login.c | 6 | ||||
-rw-r--r-- | src/libsystemd/sd-login/test-login.c | 10 |
10 files changed, 32 insertions, 32 deletions
diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c index 3da77cf1d7..26c25452bb 100644 --- a/src/libsystemd/sd-bus/bus-creds.c +++ b/src/libsystemd/sd-bus/bus-creds.c @@ -749,7 +749,7 @@ int bus_creds_add_more(sd_bus_creds *c, uint64_t mask, pid_t pid, pid_t tid) { if (tid > 0 && (missing & SD_BUS_CREDS_TID_COMM)) { _cleanup_free_ char *p = NULL; - if (asprintf(&p, "/proc/%lu/task/%lu/comm", (unsigned long) pid, (unsigned long) tid) < 0) + if (asprintf(&p, "/proc/"PID_FMT"/task/"PID_FMT"/comm", pid, tid) < 0) return -ENOMEM; r = read_one_line_file(p, &c->tid_comm); diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c index 6f4ce0c42f..8b70b20e80 100644 --- a/src/libsystemd/sd-bus/bus-dump.c +++ b/src/libsystemd/sd-bus/bus-dump.c @@ -98,11 +98,11 @@ int bus_message_dump(sd_bus_message *m, FILE *f, bool with_header) { ansi_highlight_red(), strna(m->error.message), ansi_highlight_off()); if (m->monotonic != 0) - fprintf(f, " Monotonic=%llu", (unsigned long long) m->monotonic); + fprintf(f, " Monotonic="USEC_FMT, m->monotonic); if (m->realtime != 0) - fprintf(f, " Realtime=%llu", (unsigned long long) m->realtime); + fprintf(f, " Realtime="USEC_FMT, m->realtime); if (m->seqnum != 0) - fprintf(f, " SequenceNumber=%llu", (unsigned long long) m->seqnum); + fprintf(f, " SequenceNumber=%"PRIu64, m->seqnum); if (m->monotonic != 0 || m->realtime != 0 || m->seqnum != 0) fputs("\n", f); @@ -221,11 +221,11 @@ int bus_message_dump(sd_bus_message *m, FILE *f, bool with_header) { break; case SD_BUS_TYPE_INT64: - fprintf(f, "%sINT64 %s%lli%s;\n", prefix, ansi_highlight(), (long long) basic.s64, ansi_highlight_off()); + fprintf(f, "%sINT64 %s%"PRIi64"%s;\n", prefix, ansi_highlight(), basic.s64, ansi_highlight_off()); break; case SD_BUS_TYPE_UINT64: - fprintf(f, "%sUINT64 %s%llu%s;\n", prefix, ansi_highlight(), (unsigned long long) basic.u64, ansi_highlight_off()); + fprintf(f, "%sUINT64 %s%"PRIu64"%s;\n", prefix, ansi_highlight(), basic.u64, ansi_highlight_off()); break; case SD_BUS_TYPE_DOUBLE: @@ -319,18 +319,18 @@ int bus_creds_dump(sd_bus_creds *c, FILE *f) { f = stdout; if (c->mask & SD_BUS_CREDS_PID) - fprintf(f, " PID=%lu", (unsigned long) c->pid); + fprintf(f, " PID="PID_FMT, c->pid); if (c->mask & SD_BUS_CREDS_PID_STARTTIME) - fprintf(f, " PIDStartTime=%llu", (unsigned long long) c->pid_starttime); + fprintf(f, " PIDStartTime="USEC_FMT, c->pid_starttime); if (c->mask & SD_BUS_CREDS_TID) - fprintf(f, " TID=%lu", (unsigned long) c->tid); + fprintf(f, " TID="PID_FMT, c->tid); if (c->mask & SD_BUS_CREDS_UID) - fprintf(f, " UID=%lu", (unsigned long) c->uid); + fprintf(f, " UID="UID_FMT, c->uid); r = sd_bus_creds_get_owner_uid(c, &owner); if (r >= 0) - fprintf(f, " OwnerUID=%lu", (unsigned long) owner); + fprintf(f, " OwnerUID="UID_FMT, owner); if (c->mask & SD_BUS_CREDS_GID) - fprintf(f, " GID=%lu", (unsigned long) c->gid); + fprintf(f, " GID="GID_FMT, c->gid); if ((c->mask & (SD_BUS_CREDS_PID|SD_BUS_CREDS_PID_STARTTIME|SD_BUS_CREDS_TID|SD_BUS_CREDS_UID|SD_BUS_CREDS_GID)) || r >= 0) fputs("\n", f); @@ -387,11 +387,11 @@ int bus_creds_dump(sd_bus_creds *c, FILE *f) { if (sd_bus_creds_get_audit_login_uid(c, &audit_loginuid) >= 0) { audit_loginuid_is_set = true; - fprintf(f, " AuditLoginUID=%lu", (unsigned long) audit_loginuid); + fprintf(f, " AuditLoginUID="UID_FMT, audit_loginuid); } if (sd_bus_creds_get_audit_session_id(c, &audit_sessionid) >= 0) { audit_sessionid_is_set = true; - fprintf(f, " AuditSessionID=%lu", (unsigned long) audit_sessionid); + fprintf(f, " AuditSessionID=%"PRIu32, audit_sessionid); } if (audit_loginuid_is_set || audit_sessionid_is_set) diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index af42b9f5e1..8bab6ad1be 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -1305,7 +1305,7 @@ int bus_kernel_create_bus(const char *name, bool world, char **s) { make->size += ALIGN8(n->size); n = KDBUS_ITEM_NEXT(n); - sprintf(n->str, "%lu-%s", (unsigned long) getuid(), name); + sprintf(n->str, UID_FMT"-%s", getuid(), name); n->size = offsetof(struct kdbus_item, str) + strlen(n->str) + 1; n->type = KDBUS_ITEM_MAKE_NAME; make->size += ALIGN8(n->size); @@ -1396,7 +1396,7 @@ int bus_kernel_create_starter(const char *bus, const char *name, bool activating assert(name); p = alloca(strlen("/dev/kdbus/") + DECIMAL_STR_MAX(uid_t) + 1 + strlen(bus) + strlen("/bus") + 1); - sprintf(p, "/dev/kdbus/%lu-%s/bus", (unsigned long) getuid(), bus); + sprintf(p, "/dev/kdbus/"UID_FMT"-%s/bus", getuid(), bus); fd = open(p, O_RDWR|O_NOCTTY|O_CLOEXEC); if (fd < 0) @@ -1511,7 +1511,7 @@ int bus_kernel_create_monitor(const char *bus) { assert(bus); p = alloca(strlen("/dev/kdbus/") + DECIMAL_STR_MAX(uid_t) + 1 + strlen(bus) + strlen("/bus") + 1); - sprintf(p, "/dev/kdbus/%lu-%s/bus", (unsigned long) getuid(), bus); + sprintf(p, "/dev/kdbus/"UID_FMT"-%s/bus", getuid(), bus); fd = open(p, O_RDWR|O_NOCTTY|O_CLOEXEC); if (fd < 0) diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c index 2e8f008be4..d124d9aa13 100644 --- a/src/libsystemd/sd-bus/bus-socket.c +++ b/src/libsystemd/sd-bus/bus-socket.c @@ -648,7 +648,7 @@ static int bus_socket_start_auth_client(sd_bus *b) { auth_prefix = "\0AUTH EXTERNAL "; - snprintf(text, sizeof(text), "%lu", (unsigned long) geteuid()); + snprintf(text, sizeof(text), UID_FMT, geteuid()); char_array_0(text); l = strlen(text); diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c index b5b3c857b8..6220934bd8 100644 --- a/src/libsystemd/sd-bus/bus-util.c +++ b/src/libsystemd/sd-bus/bus-util.c @@ -537,7 +537,7 @@ int bus_open_user_systemd(sd_bus **_bus) { if (r < 0) return r; - if (asprintf(&bus->address, KERNEL_USER_BUS_FMT, (unsigned long) getuid()) < 0) + if (asprintf(&bus->address, KERNEL_USER_BUS_FMT, getuid()) < 0) return -ENOMEM; bus->bus_client = true; diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index ea80e9d19b..de947bf5c6 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -1162,13 +1162,13 @@ int bus_set_address_user(sd_bus *b) { return -ENOMEM; #ifdef ENABLE_KDBUS - asprintf(&b->address, KERNEL_USER_BUS_FMT ";" UNIX_USER_BUS_FMT, (unsigned long) getuid(), ee); + asprintf(&b->address, KERNEL_USER_BUS_FMT ";" UNIX_USER_BUS_FMT, getuid(), ee); #else asprintf(&b->address, UNIX_USER_BUS_FMT, ee); #endif } else { #ifdef ENABLE_KDBUS - asprintf(&b->address, KERNEL_USER_BUS_FMT, (unsigned long) getuid()); + asprintf(&b->address, KERNEL_USER_BUS_FMT, getuid()); #else return -ECONNREFUSED; #endif diff --git a/src/libsystemd/sd-bus/test-bus-chat.c b/src/libsystemd/sd-bus/test-bus-chat.c index c9eb69843d..d5903f41d5 100644 --- a/src/libsystemd/sd-bus/test-bus-chat.c +++ b/src/libsystemd/sd-bus/test-bus-chat.c @@ -160,9 +160,9 @@ static int server(sd_bus *bus) { sd_bus_creds_get_pid(sd_bus_message_get_creds(m), &pid); sd_bus_creds_get_selinux_context(sd_bus_message_get_creds(m), &label); - log_info("Got message! member=%s pid=%lu label=%s", + log_info("Got message! member=%s pid="PID_FMT" label=%s", strna(sd_bus_message_get_member(m)), - (unsigned long) pid, + pid, strna(label)); /* bus_message_dump(m); */ /* sd_bus_message_rewind(m, true); */ diff --git a/src/libsystemd/sd-bus/test-bus-marshal.c b/src/libsystemd/sd-bus/test-bus-marshal.c index 2321873da5..2be4de571e 100644 --- a/src/libsystemd/sd-bus/test-bus-marshal.c +++ b/src/libsystemd/sd-bus/test-bus-marshal.c @@ -156,7 +156,7 @@ int main(int argc, char *argv[]) { h = hexmem(buffer, sz); assert_se(h); - log_info("message size = %lu, contents =\n%s", (unsigned long) sz, h); + log_info("message size = %zu, contents =\n%s", sz, h); free(h); #ifdef HAVE_GLIB diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c index 39445a191b..e7eea19580 100644 --- a/src/libsystemd/sd-login/sd-login.c +++ b/src/libsystemd/sd-login/sd-login.c @@ -172,7 +172,7 @@ _public_ int sd_uid_get_state(uid_t uid, char**state) { assert_return(state, -EINVAL); - if (asprintf(&p, "/run/systemd/users/%lu", (unsigned long) uid) < 0) + if (asprintf(&p, "/run/systemd/users/"UID_FMT, uid) < 0) return -ENOMEM; r = parse_env_file(p, NEWLINE, "STATE", &s, NULL); @@ -215,7 +215,7 @@ _public_ int sd_uid_is_on_seat(uid_t uid, int require_active, const char *seat) if (!s) return -EIO; - if (asprintf(&t, "%lu", (unsigned long) uid) < 0) + if (asprintf(&t, UID_FMT, uid) < 0) return -ENOMEM; FOREACH_WORD(w, l, s, state) { @@ -231,7 +231,7 @@ static int uid_get_array(uid_t uid, const char *variable, char ***array) { char **a; int r; - if (asprintf(&p, "/run/systemd/users/%lu", (unsigned long) uid) < 0) + if (asprintf(&p, "/run/systemd/users/"UID_FMT, uid) < 0) return -ENOMEM; r = parse_env_file(p, NEWLINE, diff --git a/src/libsystemd/sd-login/test-login.c b/src/libsystemd/sd-login/test-login.c index 9e326de5b4..ccf2c95816 100644 --- a/src/libsystemd/sd-login/test-login.c +++ b/src/libsystemd/sd-login/test-login.c @@ -47,7 +47,7 @@ static void test_login(void) { printf("session = %s\n", session); assert_se(sd_pid_get_owner_uid(0, &u2) == 0); - printf("user = %lu\n", (unsigned long) u2); + printf("user = "UID_FMT"\n", u2); assert_se(socketpair(AF_UNIX, SOCK_STREAM, 0, pair) == 0); sd_peer_get_session(pair[0], &pp); @@ -88,7 +88,7 @@ static void test_login(void) { free(state); assert_se(sd_session_get_uid(session, &u) >= 0); - printf("uid = %lu\n", (unsigned long) u); + printf("uid = "UID_FMT"\n", u); assert_se(u == u2); assert_se(sd_session_get_type(session, &type) >= 0); @@ -137,7 +137,7 @@ static void test_login(void) { assert_se(sd_seat_get_active(seat, &session2, &u2) >= 0); printf("session2 = %s\n", session2); - printf("uid2 = %lu\n", (unsigned long) u2); + printf("uid2 = "UID_FMT"\n", u2); r = sd_seat_get_sessions(seat, &sessions, &uids, &n); assert_se(r >= 0); @@ -149,7 +149,7 @@ static void test_login(void) { free(t); printf("uids ="); for (k = 0; k < (int) n; k++) - printf(" %lu", (unsigned long) uids[k]); + printf(" "UID_FMT, uids[k]); printf("\n"); free(uids); @@ -192,7 +192,7 @@ static void test_login(void) { printf("uids ="); for (k = 0; k < r; k++) - printf(" %lu", (unsigned long) uids[k]); + printf(" "UID_FMT, uids[k]); printf("\n"); free(uids); |