summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/dbus-common.h1
-rw-r--r--src/shared/macro.h1
-rw-r--r--src/shared/strv.c8
-rw-r--r--src/shared/strv.h1
-rw-r--r--src/shared/util.c2
5 files changed, 12 insertions, 1 deletions
diff --git a/src/shared/dbus-common.h b/src/shared/dbus-common.h
index 394ab4cb60..005a715d0a 100644
--- a/src/shared/dbus-common.h
+++ b/src/shared/dbus-common.h
@@ -22,6 +22,7 @@
***/
#include <dbus/dbus.h>
+#include <inttypes.h>
#ifndef DBUS_ERROR_UNKNOWN_OBJECT
#define DBUS_ERROR_UNKNOWN_OBJECT "org.freedesktop.DBus.Error.UnknownObject"
diff --git a/src/shared/macro.h b/src/shared/macro.h
index dbdf5b3fb0..e930fdab53 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -192,6 +192,7 @@ static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) {
#define _cleanup_close_ __attribute__((cleanup(closep)))
#define _cleanup_closedir_ __attribute__((cleanup(closedirp)))
#define _cleanup_umask_ __attribute__((cleanup(umaskp)))
+#define _cleanup_strv_free_ __attribute__((cleanup(strv_freep)))
#define VA_FORMAT_ADVANCE(format, ap) \
do { \
diff --git a/src/shared/strv.c b/src/shared/strv.c
index c8d856344c..822b2dc888 100644
--- a/src/shared/strv.c
+++ b/src/shared/strv.c
@@ -64,6 +64,14 @@ void strv_free(char **l) {
free(l);
}
+void strv_freep(char ***l) {
+ if (!l)
+ return;
+
+ strv_free(*l);
+ *l = NULL;
+}
+
char **strv_copy(char **l) {
char **r, **k;
diff --git a/src/shared/strv.h b/src/shared/strv.h
index ae4e31f14c..81e33356f9 100644
--- a/src/shared/strv.h
+++ b/src/shared/strv.h
@@ -30,6 +30,7 @@ char *strv_find(char **l, const char *name);
char *strv_find_prefix(char **l, const char *name);
void strv_free(char **l);
+void strv_freep(char ***l);
char **strv_copy(char **l) _malloc_;
unsigned strv_length(char **l);
diff --git a/src/shared/util.c b/src/shared/util.c
index 1e1eb2af5f..50c4c08993 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -1959,7 +1959,7 @@ char *format_timestamp(char *buf, size_t l, usec_t t) {
sec = (time_t) (t / USEC_PER_SEC);
- if (strftime(buf, l, "%a, %d %b %Y %H:%M:%S %z", localtime_r(&sec, &tm)) <= 0)
+ if (strftime(buf, l, "%a, %Y-%m-%d %H:%M:%S %Z", localtime_r(&sec, &tm)) <= 0)
return NULL;
return buf;