summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-07-12 09:10:13 +0200
committerLennart Poettering <lennart@poettering.net>2019-07-12 09:11:44 +0200
commit2dc66a6417acaefe4e6ab923c04dd7fe182c07b9 (patch)
treef0c80cf9f6f361f2b44119c34b76d4c8b8882cd0 /src/test
parent7d025debfadc82391a5f3e7228c24cef6f199981 (diff)
downloadsystemd-2dc66a6417acaefe4e6ab923c04dd7fe182c07b9.tar.gz
systemd-2dc66a6417acaefe4e6ab923c04dd7fe182c07b9.tar.bz2
systemd-2dc66a6417acaefe4e6ab923c04dd7fe182c07b9.zip
test: modernize test-alloc-util.c test a bit
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-alloc-util.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/test-alloc-util.c b/src/test/test-alloc-util.c
index 71ecda0b99..758b753237 100644
--- a/src/test/test-alloc-util.c
+++ b/src/test/test-alloc-util.c
@@ -56,20 +56,20 @@ static void test_GREEDY_REALLOC(void) {
}
static void test_memdup_multiply_and_greedy_realloc(void) {
- int org[] = {1, 2, 3};
+ static const int org[] = { 1, 2, 3 };
_cleanup_free_ int *dup;
int *p;
size_t i, allocated = 3;
- dup = (int*) memdup_suffix0_multiply(org, sizeof(int), 3);
+ dup = memdup_suffix0_multiply(org, sizeof(int), 3);
assert_se(dup);
assert_se(dup[0] == 1);
assert_se(dup[1] == 2);
assert_se(dup[2] == 3);
- assert_se(*(uint8_t*) (dup + 3) == (uint8_t) 0);
+ assert_se(((uint8_t*) dup)[sizeof(int) * 3] == 0);
free(dup);
- dup = (int*) memdup_multiply(org, sizeof(int), 3);
+ dup = memdup_multiply(org, sizeof(int), 3);
assert_se(dup);
assert_se(dup[0] == 1);
assert_se(dup[1] == 2);