mirror of
https://github.com/systemd/systemd.git
synced 2024-11-06 16:59:03 +03:00
test-copy: remove unnecessary initialization
Initializing just some of the values doesn't make sense. We should handle them all in the same way. In those tests there are no jumps, all steps are covered with assert_se(), so we know everything will be set if we get to the end of the function. And _not_ initializing those variables has the advantage that it allows valgrind to catch potential initalization errors in the function being tested.
This commit is contained in:
parent
dcd6361ea1
commit
9421cab6db
@ -117,8 +117,8 @@ static void test_copy_tree(void) {
|
|||||||
assert_se(copy_tree(original_dir, copy_dir, UID_INVALID, GID_INVALID, COPY_REFLINK|COPY_MERGE) == 0);
|
assert_se(copy_tree(original_dir, copy_dir, UID_INVALID, GID_INVALID, COPY_REFLINK|COPY_MERGE) == 0);
|
||||||
|
|
||||||
STRV_FOREACH(p, files) {
|
STRV_FOREACH(p, files) {
|
||||||
_cleanup_free_ char *buf = NULL, *f;
|
_cleanup_free_ char *buf, *f;
|
||||||
size_t sz = 0;
|
size_t sz;
|
||||||
|
|
||||||
assert_se(f = strappend(copy_dir, *p));
|
assert_se(f = strappend(copy_dir, *p));
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ static void test_copy_tree(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
STRV_FOREACH_PAIR(link, p, links) {
|
STRV_FOREACH_PAIR(link, p, links) {
|
||||||
_cleanup_free_ char *target = NULL, *f, *l;
|
_cleanup_free_ char *target, *f, *l;
|
||||||
|
|
||||||
assert_se(f = strjoin(original_dir, *p));
|
assert_se(f = strjoin(original_dir, *p));
|
||||||
assert_se(l = strjoin(copy_dir, *link));
|
assert_se(l = strjoin(copy_dir, *link));
|
||||||
|
Loading…
Reference in New Issue
Block a user