summaryrefslogtreecommitdiff
path: root/src/test/test-time-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-06-04 21:07:27 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-06-06 09:52:52 +0200
commit89eb3d7c95b8dc3d40471b73699c464994769844 (patch)
tree49d58ba4e01cd9e25a748a8e473581db9cfc2e3e /src/test/test-time-util.c
parenta5b28b772105ca192aab730c6179722e48999ba3 (diff)
downloadsystemd-89eb3d7c95b8dc3d40471b73699c464994769844.tar.gz
various: use CONST_MAX for array allocation
IIUC, with MAX() we get a VLA and the size is "decided" at runtime, even though the result is always the same, but with CONST_MAX() we get a normal stack variable.
Diffstat (limited to 'src/test/test-time-util.c')
-rw-r--r--src/test/test-time-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/test-time-util.c b/src/test/test-time-util.c
index 86a60604da..e8e4e2a67b 100644
--- a/src/test/test-time-util.c
+++ b/src/test/test-time-util.c
@@ -314,7 +314,7 @@ TEST(usec_sub_signed) {
TEST(format_timestamp) {
for (unsigned i = 0; i < 100; i++) {
- char buf[MAX(FORMAT_TIMESTAMP_MAX, FORMAT_TIMESPAN_MAX)];
+ char buf[CONST_MAX(FORMAT_TIMESTAMP_MAX, FORMAT_TIMESPAN_MAX)];
usec_t x, y;
x = random_u64_range(2147483600 * USEC_PER_SEC) + 1;
@@ -374,7 +374,7 @@ TEST(FORMAT_TIMESTAMP) {
}
TEST(format_timestamp_relative) {
- char buf[MAX(FORMAT_TIMESTAMP_MAX, FORMAT_TIMESPAN_MAX)];
+ char buf[CONST_MAX(FORMAT_TIMESTAMP_MAX, FORMAT_TIMESPAN_MAX)];
usec_t x;
/* Only testing timestamps in the past so we don't need to add some delta to account for time passing