From: Zbigniew Jędrzejewski-Szmek Date: Thu, 24 May 2018 07:36:56 +0000 (+0200) Subject: Use const char* for timestamp strings which we don't plan to modify X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=a6aa5c9e8f623797c3868ab0bc5805543b4ef1b7;p=elogind.git Use const char* for timestamp strings which we don't plan to modify Makes the intent a bit clearer. --- diff --git a/src/login/loginctl.c b/src/login/loginctl.c index 6b4c381f0..f15e0315d 100644 --- a/src/login/loginctl.c +++ b/src/login/loginctl.c @@ -492,8 +492,9 @@ static int print_session_status_info(sd_bus *bus, const char *path, bool *new_li _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL; - char since1[FORMAT_TIMESTAMP_RELATIVE_MAX], *s1; - char since2[FORMAT_TIMESTAMP_MAX], *s2; + char since1[FORMAT_TIMESTAMP_RELATIVE_MAX]; + char since2[FORMAT_TIMESTAMP_MAX]; + const char *s1, *s2; SessionStatusInfo i = {}; int r; @@ -625,8 +626,9 @@ static int print_user_status_info(sd_bus *bus, const char *path, bool *new_line) _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL; - char since1[FORMAT_TIMESTAMP_RELATIVE_MAX], *s1; - char since2[FORMAT_TIMESTAMP_MAX], *s2; + char since1[FORMAT_TIMESTAMP_RELATIVE_MAX]; + char since2[FORMAT_TIMESTAMP_MAX]; + const char *s1, *s2; _cleanup_(user_status_info_clear) UserStatusInfo i = {}; int r; diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index 4f66bb3b7..195b1a69e 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -701,7 +701,8 @@ int bus_print_property(const char *name, sd_bus_message *m, bool value, bool all * should it turn out to not be sufficient */ if (endswith(name, "Timestamp") || STR_IN_SET(name, "NextElapseUSecRealtime", "LastTriggerUSec")) { - char timestamp[FORMAT_TIMESTAMP_MAX], *t; + char timestamp[FORMAT_TIMESTAMP_MAX]; + const char *t; t = format_timestamp(timestamp, sizeof(timestamp), u); if (t || all)