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/sd-bus | |
parent | 12ed81d9c88406234c20e9261ae8c8b992d8bc4d (diff) |
Remove unnecessary casts in printfs
No functional change expected :)
Diffstat (limited to 'src/libsystemd/sd-bus')
-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 |
8 files changed, 24 insertions, 24 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 |