]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pull: use ASSERT_PTR() to shorten code a tiny bit
authorLennart Poettering <lennart@poettering.net>
Wed, 5 Nov 2025 21:27:33 +0000 (22:27 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 8 Nov 2025 08:28:50 +0000 (09:28 +0100)
src/import/pull-raw.c
src/import/pull-tar.c

index bf662c24b95b3ebc613837b1a948cdb9a89d83e6..ef10745ba85c71e4469bb3da861453136e2019a9 100644 (file)
@@ -500,13 +500,10 @@ static int raw_pull_rename_auxiliary_file(
 }
 
 static void raw_pull_job_on_finished(PullJob *j) {
-        RawPull *i;
         int r;
 
         assert(j);
-        assert(j->userdata);
-
-        i = j->userdata;
+        RawPull *i = ASSERT_PTR(j->userdata);
 
         if (j->error != 0) {
                 /* Only the main job and the checksum job are fatal if they fail. The other fails are just
index 168ea08de84a06af73eadac530783abb27b52fc3..05b58f7976442a5a556ec80c537de1c868576f7a 100644 (file)
@@ -399,13 +399,10 @@ static bool tar_pull_is_done(TarPull *i) {
 }
 
 static void tar_pull_job_on_finished(PullJob *j) {
-        TarPull *i;
         int r;
 
         assert(j);
-        assert(j->userdata);
-
-        i = j->userdata;
+        TarPull *i = ASSERT_PTR(j->userdata);
 
         if (j->error != 0) {
                 clear_progress_bar(/* prefix= */ NULL);
@@ -582,13 +579,11 @@ finish:
 
 static int tar_pull_job_on_open_disk_tar(PullJob *j) {
         const char *where;
-        TarPull *i;
         int r;
 
         assert(j);
-        assert(j->userdata);
 
-        i = j->userdata;
+        TarPull *i = ASSERT_PTR(j->userdata);
         assert(i->tar_job == j);
         assert(!pidref_is_set(&i->tar_pid));
         assert(i->tree_fd < 0);